Réglage time, réglage usleep, réglage menu

This commit is contained in:
2023-12-22 15:11:29 +01:00
parent 284f9bea71
commit 29ed7dc6df
18 changed files with 99 additions and 316 deletions

View File

@@ -1,29 +1,31 @@
CC = gcc
CFLAGS = -ansi -pedantic -lgraph
OBJS = main.o serpent.o time.o terrain.o Oeuf.o
SRCDIR = ./src
HDIR = ./fichier.h
ODIR = ./out
OFILES = $(subst $(SRCDIR)/,$(ODIR)/,$(subst .c,.o,$(shell find $(SRCDIR)/ -type f)))
EXE = snake
.PHONY: all clean run
snake: $(OBJS)
$(CC) -o snake $(OBJS) $(CFLAGS)
all: $(EXE)
main.o: serpent.h time.h Oeuf.h main.h menu.h
$(CC) -c main.c $(CFLAGS)
$(ODIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(@D)
$(CC) -c $< -o $@
serpent.o: serpent.h
$(CC) -c serpent.c $(CFLAGS)
$(EXE) : $(OFILES)
$(CC) $(CFLAGS) -o $(EXE) $(OFILES)
menu.o: main.h time.h
$(CC) -c menu.c $(CFLAGS)
run : $(EXE)
./$(EXE)
time.o: time.h serpent.h main.h
$(CC) -c time.c $(CFLAGS)
clean :
-rm -rf $(ODIR)
Oeuf.o: Oeuf.h time.h
$(CC) -c Oeuf.c $(CFLAGS)
# Nouvelle règle pour la dépendance implicite
$(EXE): $(ODIR)/a.out
terrain.o: terrain.h serpent.h time.h main.h Oeuf.h
$(CC) -c terrain.c $(CFLAGS)
clean:
rm -f *.o snake
# Nouvelle règle pour construire 'out/a.out'
$(ODIR)/a.out: $(OFILES)
$(CC) $(CFLAGS) -o $@ $(OFILES)