forked from vieter-v/libvieter
chore: added makefile
parent
f50bc4a3c4
commit
4d72e60515
|
@ -0,0 +1,2 @@
|
|||
build/
|
||||
compile_commands.json
|
|
@ -0,0 +1,41 @@
|
|||
LIB_FILENAME ?= libvieter.a
|
||||
|
||||
BUILD_DIR ?= build
|
||||
SRC_DIR ?= src
|
||||
INC_DIRS ?= include
|
||||
|
||||
SRCS != find '$(SRC_DIR)' -iname '*.c'
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
DEPS := $(SRCS:%=$(BUILD_DIR)/%.d)
|
||||
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
# -MMD: generate a .d file for every source file. This file can be imported by
|
||||
# make and makes make aware that a header file has been changed, ensuring an
|
||||
# object file is also recompiled if only a header is changed.
|
||||
# -MP: generate a dummy target for every header file (according to the docs it
|
||||
# prevents some errors when removing header files)
|
||||
CFLAGS ?= $(INC_FLAGS) -O3 -MMD -MP -Wall -Werror -Wextra
|
||||
|
||||
.PHONY: all
|
||||
all: vieter
|
||||
|
||||
|
||||
# =====COMPILATION=====
|
||||
.PHONY: vieter
|
||||
vieter: $(BUILD_DIR)/$(LIB_FILENAME)
|
||||
$(BUILD_DIR)/$(LIB_FILENAME): $(OBJS)
|
||||
ar -rcs $@ $(OBJS)
|
||||
|
||||
$(BUILD_DIR)/%.c.o: %.c
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
|
||||
# Make make aware of the .d files
|
||||
-include $(DEPS)
|
|
@ -1,4 +1,4 @@
|
|||
#include "expression.h"
|
||||
#include "vieter_cron.h"
|
||||
#include <time.h>
|
||||
|
||||
const uint8_t month_days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "expression.h"
|
||||
#include "vieter_cron.h"
|
||||
|
||||
// This prefix is needed to properly compile
|
||||
const uint8_t parse_month_days[] = {31, 28, 31, 30, 31, 30,
|
||||
|
|
Loading…
Reference in New Issue