Skip to content
Snippets Groups Projects
Makefile 1.29 KiB
Newer Older
Og's avatar
Og committed
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
Og's avatar
Og committed

############# 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 gfx.o main.c
Og's avatar
Og committed
	$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)

math_lib.o: math_lib.c
	$(CC) -c $^ $(CFLAGS) $(LDFLAGS)

Og's avatar
Og committed
	$(CC) -c $^ $(CFLAGS) $(LDFLAGS)

traitementPGM.o: traitementPGM.c
	$(CC) -c $^ $(CFLAGS) $(LDFLAGS)

gfx.o: gfx.c
	$(CC) -c $^ $(CFLAGS) $(LDFLAGS)

Og's avatar
Og committed
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)