-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (42 loc) · 1.04 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PROJECTNAME=calc
BIN=build/$(PROJECTNAME)
CC=clang
#OPT=-O3
OPT=-Og -g -ggdb
DEPFLAGS=-MP -MD
FLAGS=-Wall -Wextra -I. $(OPT) $(DEPFLAGS) $(EXTRAFLAGS)
SRC=$(shell ls *.c)
OBJ=$(foreach S, $(SRC:.c=.o), build/$(S))
$(shell mkdir -p build)
all : $(BIN)
$(BIN) : $(OBJ)
$(CC) $(FLAGS) -o $@ $^
-include $(OBJ:.o=.d) $(LIBO:.o=.d)
build/%.o : %.c
@mkdir -p $(@D)
$(CC) $(FLAGS) -o $@ -c $<
run : $(BIN)
./$< $(input)
clean :
rm -rf build/*
check :
cppcheck --enable=all --suppress=missingIncludeSystem -I. .
gcc -fanalyzer $(FLAGS) $(SRC) -o $(BIN)
for file in $(SRC); do echo "clang analyze $$file :"; clang --analyze $$file -o ./build/clang.analyze; done
#flawfinder .
debug : $(BIN)
gdb $< $(input)
# unzip : tar -xvf exemple.tgz
dist : clean
$(info /!\ project folder has to be named $(PROJECTNAME) /!\ )
cd .. && tar zcvf $(PROJECTNAME)/build/$(PROJECTNAME).tgz $(PROJECTNAME) >/dev/null
push :
git push bbsrv
git push gh
# alias
r : run
t : test
c : check
p : push
d : debug
.PHONY : all run r clean check c debug d dist push p info