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 ############# 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): Matrix.o math_lib.o traitementPGM.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) 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)