2024-04-17 16:01:28 +02:00
|
|
|
CC = gcc
|
|
|
|
RM = rm -rf
|
|
|
|
TAR = tar -cf
|
|
|
|
CP = cp -r
|
|
|
|
MKDIR = mkdir -p
|
|
|
|
|
|
|
|
SRC_DIR = src
|
|
|
|
INC_DIR = includes
|
|
|
|
SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
|
|
|
OBJETS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
|
|
|
|
|
|
|
|
CFLAGS = -std=gnu11 -pedantic
|
|
|
|
LDFLAGS =
|
|
|
|
|
|
|
|
EXE = project
|
|
|
|
EXE_EXT = .elf
|
|
|
|
|
2024-04-20 21:24:18 +02:00
|
|
|
ARCHIVE_NAME = nom1-nom2
|
|
|
|
PDF_DIR = report
|
|
|
|
PDF_NEWNAME = Rapport de projet
|
2024-04-17 16:01:28 +02:00
|
|
|
|
|
|
|
%.o: src/%.c
|
|
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
|
|
|
|
2024-04-18 22:33:25 +02:00
|
|
|
release: CFLAGS += -O3
|
|
|
|
release: compilation
|
2024-04-17 16:01:28 +02:00
|
|
|
|
|
|
|
debug: CFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes
|
|
|
|
debug: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og
|
2024-05-06 12:20:59 +02:00
|
|
|
debug: LDFLAGS += -fsanitize=undefined -fsanitize=leak
|
2024-04-17 16:01:28 +02:00
|
|
|
debug: compilation
|
|
|
|
|
2024-04-18 22:33:25 +02:00
|
|
|
compilation: $(OBJETS)
|
|
|
|
$(CC) -o $(EXE)$(EXE_EXT) $(OBJETS) $(LDFLAGS)
|
|
|
|
|
2024-04-17 16:01:28 +02:00
|
|
|
all:
|
2024-04-18 22:33:25 +02:00
|
|
|
release
|
2024-04-17 16:01:28 +02:00
|
|
|
|
|
|
|
pdf-make:
|
|
|
|
cd report && \
|
|
|
|
$(MAKE)
|
|
|
|
|
|
|
|
pdf-clean:
|
2024-04-21 12:03:27 +02:00
|
|
|
-@cd report && \
|
2024-04-17 16:01:28 +02:00
|
|
|
$(MAKE) clean
|
|
|
|
|
|
|
|
clean: pdf-clean
|
2024-04-20 21:24:18 +02:00
|
|
|
$(RM) $(OBJETS) "$(EXE)$(EXE_EXT)" "$(ARCHIVE_NAME).tar"
|
2024-04-17 16:01:28 +02:00
|
|
|
|
|
|
|
archive: pdf-make
|
2024-04-20 21:24:18 +02:00
|
|
|
$(MKDIR) "$(ARCHIVE_NAME)"
|
2024-04-20 20:43:00 +02:00
|
|
|
$(CP) "$(SRC_DIR)" "$(INC_DIR)" Makefile README.md \
|
2024-04-20 21:24:18 +02:00
|
|
|
"$(wildcard $(PDF_DIR)/*.pdf)" "$(ARCHIVE_NAME)"
|
|
|
|
$(TAR) "$(ARCHIVE_NAME).tar" "$(ARCHIVE_NAME)"
|
|
|
|
$(RM) "$(ARCHIVE_NAME)"
|