2024-03-15 12:19:51 +01:00
|
|
|
CC = gcc
|
|
|
|
RM = rm -rf
|
|
|
|
TAR = tar -cf
|
|
|
|
CP = cp -r
|
|
|
|
MKDIR = mkdir -p
|
2024-03-09 18:22:32 +01:00
|
|
|
|
|
|
|
SRC_DIR = src
|
|
|
|
INC_DIR = includes
|
2024-04-23 12:11:18 +02:00
|
|
|
|
|
|
|
SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
|
|
|
SOURCES_NOSCHED = $(filter-out $(wildcard $(SRC_DIR)/sched-*.c), $(SOURCES))
|
|
|
|
|
|
|
|
ALL_OBJECTS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
|
|
|
|
OBJECTS = $(patsubst %.c,%.o,$(notdir $(SOURCES_NOSCHED)))
|
2024-03-09 18:22:32 +01:00
|
|
|
|
|
|
|
CFLAGS = -std=gnu11 -pedantic
|
|
|
|
LDFLAGS =
|
2024-04-23 12:11:18 +02:00
|
|
|
SCHED = sched-ws.o
|
2024-03-09 18:22:32 +01:00
|
|
|
|
2024-03-15 12:32:26 +01:00
|
|
|
EXE = ordonnanceur
|
2024-03-26 20:50:32 +01:00
|
|
|
EXE_EXT = .elf
|
2024-03-09 18:22:32 +01:00
|
|
|
|
2024-04-20 21:23:40 +02:00
|
|
|
ARCHIVE_NAME = kennel
|
|
|
|
PDF_DIR = report
|
|
|
|
PDF_NEWNAME = Rapport de projet
|
2024-03-09 18:22:32 +01:00
|
|
|
|
|
|
|
%.o: src/%.c
|
|
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
|
|
|
|
2024-04-23 12:11:18 +02:00
|
|
|
release: CFLAGS += -O2
|
2024-04-18 22:37:23 +02:00
|
|
|
release: compilation
|
2024-03-09 18:22:32 +01:00
|
|
|
|
2024-04-17 16:00:32 +02:00
|
|
|
debug: CFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes
|
|
|
|
debug: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og
|
|
|
|
debug: LDFLAGS += -fsanitize=undefined
|
|
|
|
debug: compilation
|
2024-03-09 18:22:32 +01:00
|
|
|
|
2024-04-23 12:11:18 +02:00
|
|
|
compilation: $(ALL_OBJECTS)
|
|
|
|
$(CC) -o $(EXE)$(EXE_EXT) $(OBJECTS) $(SCHED) $(LDFLAGS)
|
2024-04-18 22:37:23 +02:00
|
|
|
|
2024-03-09 18:22:32 +01:00
|
|
|
all:
|
2024-04-18 22:37:23 +02:00
|
|
|
release
|
2024-03-09 18:22:32 +01:00
|
|
|
|
2024-04-23 12:11:18 +02:00
|
|
|
# Specific schedulers
|
|
|
|
threads: SCHED = sched-threads.o
|
|
|
|
threads: release
|
|
|
|
|
|
|
|
stack: SCHED = sched-stack.o
|
|
|
|
stack: release
|
|
|
|
|
|
|
|
random: SCHED = sched-random.o
|
|
|
|
random: release
|
|
|
|
|
|
|
|
ws: SCHED = sched-ws.o
|
|
|
|
ws: release
|
|
|
|
|
2024-03-09 18:22:32 +01:00
|
|
|
pdf-make:
|
|
|
|
cd report && \
|
|
|
|
$(MAKE)
|
|
|
|
|
|
|
|
pdf-clean:
|
2024-04-21 12:03:46 +02:00
|
|
|
-@cd report && \
|
2024-03-09 18:22:32 +01:00
|
|
|
$(MAKE) clean
|
|
|
|
|
|
|
|
clean: pdf-clean
|
2024-04-23 12:11:18 +02:00
|
|
|
$(RM) *.o "$(EXE)$(EXE_EXT)" "$(ARCHIVE_NAME).tar"
|
2024-03-09 18:22:32 +01:00
|
|
|
|
|
|
|
archive: pdf-make
|
2024-04-20 21:23:40 +02:00
|
|
|
$(MKDIR) "$(ARCHIVE_NAME)"
|
|
|
|
$(CP) "$(SRC_DIR)" "$(INC_DIR)" Makefile README "$(ARCHIVE_NAME)"
|
|
|
|
$(CP) "$(wildcard $(PDF_DIR)/*.pdf)" "$(ARCHIVE_NAME)/$(PDF_NEWNAME).pdf"
|
|
|
|
$(TAR) "$(ARCHIVE_NAME).tar" "$(ARCHIVE_NAME)"
|
|
|
|
$(RM) "$(ARCHIVE_NAME)"
|