ajout fichier.h et makefile

This commit is contained in:
2023-12-19 17:27:47 +01:00
parent 9450a335f5
commit 1676f05187
19 changed files with 69 additions and 316 deletions

View File

@@ -1,25 +1,26 @@
### VARIABLES ###
CC = gcc
CFLAGS = -lgraph -ansi
SRCDIR = ./src
HDIR = ./fichier.h
ODIR = ./out
OFILES = $(subst src/,out/,$(subst .c,.o,$(shell find $(SRCDIR)/ -type f)))
EXE = game
### BUT PAR DEFAUT ###
but : $(EXE)
### REGLES ESSENTIELLES ###
$(ODIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(@D)
$(CC) -c $< -o $@
$(EXE) : $(OFILES)
$(CC) $(CFLAGS) -o $(EXE) $(OFILES)
### REGLES OPTIONNELLES ###
run : $(EXE)
./$(EXE)
clean :
-rm -rf $(ODIR)
mrproper :
clean but
### BUTS FACTICES ###
.PHONY : but run clean mrproper
CFLAGS = -ansi -pedantic -lgraph
OBJS = main.o serpent.o time.o terrain.o pastille.o
serpent: $(OBJS)
$(CC) -o serpent $(OBJS) $(CFLAGS)
main.o: serpent.h time.h pastille.h main.h
$(CC) -c main.c $(CFLAGS)
serpent.o: serpent.h
$(CC) -c serpent.c $(CFLAGS)
timer.o: timer.h serpent.h main.h
$(CC) -c timer.c $(CFLAGS)
pastille.o: pastille.h serpent.h
$(CC) -c pastille.c $(CFLAGS)
terrain.o: terrain.h serpent.h time.h main.h pastille.h
$(CC) -c terrain.c $(CFLAGS)
clean:
rm -f *.0 serpent