-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
46 lines (32 loc) · 1.27 KB
/
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
39
40
41
42
43
44
45
46
BDIR := bin
IDIR := Wahlaan
LDIR := tests/lib
ODIR := obj
TDIR := tests
VPATH = $(IDIR):$(TDIR):$(LDIR)
CC := gcc
PROTECTION := -g -DNDEBUG -Wshadow -fstack-protector -fsanitize=undefined -fsanitize=signed-integer-overflow
CFLAGS := -I$(IDIR) -I$(LDIR) $(OFLAG) -Wall -Wextra -O3 -std=c99
# CFLAGS += $(PROTECTION)
# Headers
_LIB = $(wildcard $(IDIR)/*.h) checks.h
LIB = $(patsubst $(IDIR)/%, %, $(_LIB))
# Objects
_OBJ = $(wildcard $(IDIR)/*.c)
OBJ = $(patsubst $(IDIR)/%.c, $(ODIR)/%.o, $(_OBJ)) $(ODIR)/checks.o
$(ODIR)/%.o: %.c
@$(CC) -c -o $@ $< $(CFLAGS)
$(BDIR)/%: $(ODIR)/%.o $(OBJ) $(LIB)
@$(CC) -o $@ $^ $(CFLAGS)
penazzi: $(BDIR)/penazzi
@$(BDIR)/penazzi $(SWITCH) $(RMBC) <$(INPUT) >$(OUTPUT)
performance: $(BDIR)/performance
@$(BDIR)/performance $(SWITCH) $(RMBC) <$(INPUT) >$(OUTPUT)
memory: $(BDIR)/memory
@valgrind --show-reachable=yes --track-origins=yes --leak-check=full -v --log-file="out/memory/$(notdir $(OUTPUT))" $(BDIR)/$(subst .v,,$@) $(GRAPHS) $(SWITCH) $(RMBC) <$(INPUT) >$(OUTPUT)
%.v: $(BDIR)/%
@valgrind --show-reachable=yes --track-origins=yes --leak-check=full -v --log-file="out/memory/$(notdir $(OUTPUT))" $(BDIR)/$(subst .v,,$@) $(SWITCH) $(RMBC) <$(INPUT) >$(OUTPUT)
.PRECIOUS: $(ODIR)/%.o
.PHONY: clean
clean:
@rm -f $(ODIR)/*.o $(BDIR)/*