Ajout du makefile
This commit is contained in:
73
makefile
73
makefile
@@ -1,47 +1,58 @@
|
||||
# CHAPITRE 1 : BUT FINAL
|
||||
|
||||
but : blocus
|
||||
|
||||
# CHAPITRE 2 : VARIABLES
|
||||
|
||||
OFILES = main.o \
|
||||
grid.o \
|
||||
player.o \
|
||||
game.o \
|
||||
ai.o \
|
||||
menu.o
|
||||
|
||||
# le compilateur gcc
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -Wall -ansi -pedantic -g -lgraph
|
||||
# options de compilation
|
||||
CFLAGS = -Wall -Wextra -Werror
|
||||
LDFLAGS = -lgraph
|
||||
|
||||
# CHAPITRE 3 : DEPENDANCES (REGLES IMPLICITES)
|
||||
# nom de l'exécutable
|
||||
NAME = blokus
|
||||
|
||||
main.o : main.h grid.h player.h game.h ai.h menu.h
|
||||
# dossiers
|
||||
SRC_DIR = src
|
||||
INC_DIR = include
|
||||
OBJ_DIR = obj
|
||||
|
||||
grid.o : grid.h player.h struct.h
|
||||
# sources
|
||||
SRCS = $(SRC_DIR)/main.c \
|
||||
$(SRC_DIR)/jeu.c \
|
||||
$(SRC_DIR)/jeu_humain.c \
|
||||
$(SRC_DIR)/jeu_ia.c
|
||||
|
||||
player.o : player.h grid.h struct.h
|
||||
# objets
|
||||
OBJS = $(SRCS:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
|
||||
|
||||
game.o : game.h grid.h player.h struct.h
|
||||
# headers
|
||||
INCS = -I$(INC_DIR)
|
||||
|
||||
ai.o : ai.h game.h grid.h player.h struct.h
|
||||
# règle par défaut
|
||||
all: $(OBJ_DIR) $(NAME)
|
||||
|
||||
menu.o : menu.h
|
||||
# création du dossier obj s'il n'existe pas
|
||||
$(OBJ_DIR):
|
||||
mkdir -p $(OBJ_DIR)
|
||||
|
||||
# CHAPITRE 4 : DEPENDANCES AVEC COMMANDES
|
||||
# création de l'exécutable
|
||||
$(NAME): $(OBJS)
|
||||
$(CC) $(OBJS) -o $(NAME) $(LDFLAGS)
|
||||
|
||||
blocus : $(OFILES)
|
||||
$(CC) $(CFLAGS) -o blocus $(OFILES)
|
||||
# compilation des fichiers sources
|
||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
|
||||
$(CC) $(CFLAGS) $(INCS) -c $< -o $@
|
||||
|
||||
# CHAPITRE 5 : NETTOYAGE DES FICHIERS GENERES
|
||||
# nettoyage des fichiers objets
|
||||
clean:
|
||||
rm -rf $(OBJ_DIR)
|
||||
|
||||
clean :
|
||||
-rm -f $(OFILES) blocus
|
||||
# nettoyage complet (fichiers objets et exécutable)
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
# CHAPITRE 6 : BUTS FACTICES
|
||||
# recompilation complète
|
||||
re: fclean all
|
||||
|
||||
.PHONY : but clean
|
||||
# exécution du programme
|
||||
run: all
|
||||
./$(NAME)
|
||||
|
||||
run :
|
||||
./blocus
|
||||
.PHONY: all clean fclean re run
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <graph.h>
|
||||
#include "jeu.h"
|
||||
#include "../include/jeu.h"
|
||||
|
||||
/* Fonction qui initialise le jeu */
|
||||
struct EtatJeu initialiserJeu(int tailleGrille, int mode) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include <stdlib.h> /* Pour utiliser malloc() */
|
||||
#include <graph.h> /* Pour utiliser les fonctions graphiques */
|
||||
#include <unistd.h> /* Pour utiliser usleep */
|
||||
#include "jeu.h" /* Pour utiliser les structures et les fonctions du jeu */
|
||||
#include "jeu_humain.h" /* Pour utiliser les fonctions de jeu_humain */
|
||||
#include "../include/jeu.h" /* Pour utiliser les structures et les fonctions du jeu */
|
||||
#include "../include/jeu_humain.h" /* Pour utiliser les fonctions de jeu_humain */
|
||||
|
||||
void jouerModeHumain(struct EtatJeu *etatJeu) {
|
||||
while (1) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <graph.h>
|
||||
#include <unistd.h>
|
||||
#include "jeu.h"
|
||||
#include "jeu_ia.h"
|
||||
#include "../include/jeu.h"
|
||||
#include "../include/jeu_ia.h"
|
||||
|
||||
/* Fonction qui permet de jouer avec l'IA */
|
||||
void jouerModeIA(struct EtatJeu *etatJeu) {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include <graph.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include "jeu.h"
|
||||
#include "jeu_humain.h"
|
||||
#include "jeu_ia.h"
|
||||
#include "../include/jeu.h"
|
||||
#include "../include/jeu_humain.h"
|
||||
#include "../include/jeu_ia.h"
|
||||
|
||||
/* fonction qui gère tout le menu du jeu avec les boutons et tout */
|
||||
void menuPrincipale() {
|
||||
|
||||
Reference in New Issue
Block a user