-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (50 loc) · 1.41 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
64
65
66
67
68
69
70
71
72
73
74
# I love tuna |>().
# Libraries
LIBS=#-lm -pthread
# Compiler flags
CFLAGS=-Wall -Wextra -ggdb -std=c11 -pedantic -D_POSIX_C_SOURCE=200809L #-pg
# Linker flags
LDFLAGS=#-pg
# Indentation flags
# IFLAGS=-br -brs -brf -npsl -ce -cli4 -bli4 -nut
IFLAGS=-linux -brs -brf -br
# Name of the executable
PROGRAM=prog
PROGRAM_OPT=args
PROGRAM_OBJS=main.o $(PROGRAM_OPT).o utils.o file_utils.o
.PHONY: clean all docs indent debug
all: $(PROGRAM)
# activate DEBUG, defining the SHOW_DEBUG macro
debug: CFLAGS += -D SHOW_DEBUG -g
debug: $(PROGRAM)
OPTIMIZE_FLAGS=-O3
optimize: CFLAGS += $(OPTIMIZE_FLAGS)
optimize: LDFLAGS += $(OPTIMIZE_FLAGS)
optimize: $(PROGRAM)
$(PROGRAM): $(PROGRAM_OBJS)
$(CC) -o $@ $(PROGRAM_OBJS) $(LIBS) $(LDFLAGS)
# Dependencies
main.o: main.c $(PROGRAM_OPT).h file_utils.h utils.h
$(PROGRAM_OPT).o: $(PROGRAM_OPT).c $(PROGRAM_OPT).h
$(PROGRAM_OPT).o: $(PROGRAM_OPT).c $(PROGRAM_OPT).h
$(CC) -ggdb -std=c11 -pedantic -c $<
file_utils.o: file_utils.c file_utils.h
utils.o: utils.c utils.h
.c.o:
$(CC) $(CFLAGS) -c $<
$(PROGRAM_OPT).c $(PROGRAM_OPT).h: $(PROGRAM_OPT).ggo
gengetopt < $(PROGRAM_OPT).ggo --file-name=$(PROGRAM_OPT)
clean:
rm -f *.o core.* *~ $(PROGRAM) *.bak $(PROGRAM_OPT).h $(PROGRAM_OPT).c
docs: Doxyfile
doxygen Doxyfile
Doxyfile:
doxygen -g Doxyfile
depend:
$(CC) -MM *.c
indent:
indent $(IFLAGS) *.c *.h
pmccabe:
pmccabe -v *.c
cppcheck:
cppcheck --enable=all --verbose *.c *.h