2023-11-30 13:44:06 +01:00
|
|
|
CC = gcc
|
2023-12-19 17:27:47 +01:00
|
|
|
CFLAGS = -ansi -pedantic -lgraph
|
2023-12-22 15:11:29 +01:00
|
|
|
SRCDIR = ./src
|
|
|
|
HDIR = ./fichier.h
|
|
|
|
ODIR = ./out
|
|
|
|
OFILES = $(subst $(SRCDIR)/,$(ODIR)/,$(subst .c,.o,$(shell find $(SRCDIR)/ -type f)))
|
|
|
|
EXE = snake
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
.PHONY: all clean run
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
all: $(EXE)
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
$(ODIR)/%.o : $(SRCDIR)/%.c
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CC) -c $< -o $@
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
$(EXE) : $(OFILES)
|
|
|
|
$(CC) $(CFLAGS) -o $(EXE) $(OFILES)
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
run : $(EXE)
|
|
|
|
./$(EXE)
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
clean :
|
|
|
|
-rm -rf $(ODIR)
|
2023-12-21 21:45:49 +01:00
|
|
|
|
2023-12-22 15:11:29 +01:00
|
|
|
$(EXE): $(ODIR)/a.out
|
2023-12-19 17:27:47 +01:00
|
|
|
|
2023-12-24 12:19:00 +01:00
|
|
|
# construction 'out/a.out'
|
2023-12-22 15:11:29 +01:00
|
|
|
$(ODIR)/a.out: $(OFILES)
|
|
|
|
$(CC) $(CFLAGS) -o $@ $(OFILES)
|