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
############# 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
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
math_lib.o: math_lib.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)

poulpe
committed
Matrix.o: Matrix.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)
traitementPGM.o: traitementPGM.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)
gfx.o: gfx.c
$(CC) -c $^ $(CFLAGS) $(LDFLAGS)