-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (30 loc) · 896 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
MAJOR_VERS := 0
MINOR_VERS := 1
IDIR := include
SDIR := src
ODIR := build
OUT_FILE := interp
TEST_FILE := test
CC := gcc
CWARNS := -Wall -Wshadow -Wpointer-arith -Wcast-align -Wstrict-aliasing=1 # -Waggregate-return
DEFINES := -DMAJOR_VERS=$(MAJOR_VERS) -DMINOR_VERS=$(MINOR_VERS)
CFLAGS := -I./$(IDIR) $(CWARNS) $(DEFINES) -O3 # -Og -g -fsanitize=address
HEADERS := $(wildcard $(IDIR)/*.h)
SOURCES := $(wildcard $(SDIR)/*.c)
OBJ := $(patsubst $(SDIR)%.c, $(ODIR)%.o, $(SOURCES))
$(ODIR)/%.o : $(SDIR)/%.c | $(ODIR)
$(CC) -c $^ -o $@ $(CFLAGS)
$(OUT_FILE): $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
$(ODIR):
mkdir $(ODIR)
$(TEST_FILE): tests/test.c $(filter-out $(ODIR)/main.o, $(OBJ)) $(wildcard tests/*.h)
$(CC) $^ -I./$(IDIR) $(CWARNS) $(DEFINES) -g -o $@
docs: $(SOURCES) $(HEADERS)
doxygen Doxyfile
.PHONY: clean
clean:
rm -f $(OUT_FILE)
rm -f $(TEST_FILE)
rm -rf $(ODIR)
rm -rf docs