SAE11_2023/Makefile

38 lines
544 B
Makefile
Raw Normal View History

2023-12-11 20:41:12 +01:00
### VARIABLES ###
2023-12-11 20:41:12 +01:00
CC = gcc
2023-12-14 10:32:24 +01:00
CFLAGS = -lgraph -ansi -pedantic
2023-12-11 20:41:12 +01:00
SRCDIR = ./src
HDIR = ./include
ODIR = ./out
OFILES = $(subst src/,out/,$(subst .c,.o,$(shell find $(SRCDIR)/ -type f)))
EXE = snake
2023-12-11 20:41:12 +01:00
### BUT PAR DEFAUT ###
2023-12-11 20:41:12 +01:00
but : $(EXE)
2023-12-11 20:41:12 +01:00
### REGLES ESSENTIELLES ###
2023-12-11 20:41:12 +01:00
$(ODIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(@D)
$(CC) -c $< -o $@
2023-12-11 20:41:12 +01:00
$(EXE) : $(OFILES)
$(CC) $(CFLAGS) -o $(EXE) $(OFILES)
2023-12-11 20:41:12 +01:00
### REGLES OPTIONNELLES ###
2023-12-11 20:41:12 +01:00
run : $(EXE)
./$(EXE)
2023-12-11 20:41:12 +01:00
clean :
-rm -rf $(ODIR)
2023-12-11 20:41:12 +01:00
mrproper :
rm -rf snake
2023-12-11 20:41:12 +01:00
### BUTS FACTICES ###
2023-12-11 20:41:12 +01:00
.PHONY : but run clean mrproper