Newer
Older
CC = gcc
CFLAGS = -std=gnu11 -Wall -Wextra -Wpedantic -Wwrite-strings -Walloc-zero -Wparentheses
CFLAGS += -Wlarger-than=100000 -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes -Wformat-overflow=2 -Wunused-parameter
CFLAGS += -g -pedantic -fsanitize=address -fsanitize=leak -fsanitize=undefined -Wdiscarded-qualifiers
LDFLAGS = -lm -lSDL2main -lSDL2_image -lSDL2
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
############# COMMAND HELP #############
# $(wildcard *.o) // Find all .o files
# $(SOURCES:.c=.o) // Compile with implicit compilation rules all .c
# $(patsubst %.c, %.o, $(wildcard *.o)) // Find all .c and compil with rules to .o
# pat(tern) subst(itution)
# $^ = all element
# $< = first element
# $@ = name of rules
########################################
PROG = Exe
$(PROG): math_lib.o matrix.o traitementPGM.o gfx.o main.c
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
math_lib.o: math_lib.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)
matrix.o: matrix.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)
gfx.o: gfx.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)
traitementPGM.o: traitementPGM.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)
rapport: rapport.md
pandoc -s $< -o $@.pdf --template eisvogel.latex --listings --pdf-engine pdflatex
# PHONY for function with no file generated
.PHONY: clean
clean :
rm -rf *.o $(PROG) $(TEST)
rebuild : clean $(PROG) $(TEST)