# # CONFIGURATION GENERALE # EXEC = main test OBJETS = str.o json_parser.o json_encoder.o json_array.o error.o arraylist.o server_tcp.o server_udp.o bomberstudent_server.o client.o file.o handler.o player.o game.o delay.o object.o NOM_PROJET = Projet Reseau # # SUFFIXES # .SUFFIXES: .c .o # # OBJETS # EXEC_O = $(EXEC:=.o) OBJETS_O = $(OBJETS) $(EXEC_O) # # ARGUMENTS ET COMPILATEUR # CC = gcc CCFLAGS_STD = -Wall -O3 -Werror -ansi -pedantic -std=c11 CCFLAGS_DEBUG = -D _DEBUG_ CCFLAGS = $(CCFLAGS_STD) CCLIBS = -lm -pthread # # REGLES # all: msg $(OBJETS) $(EXEC_O) @echo "Creation des executables..." @for i in $(EXEC); do \ $(CC) -o $$i $$i.o $(OBJETS) $(CCLIBS); \ done @echo "Termine." msg: @echo "Creation des objets..." debug: CCFLAGS = $(CCFLAGS_STD) $(CCFLAGS_DEBUG) debug: all # # REGLES PAR DEFAUT # .c.o: .h @cd $(dir $<) && ${CC} ${CCFLAGS} -c $(notdir $<) -o $(notdir $@) # # REGLES GENERALES # clean: @echo "Suppresion des objets, des fichiers temporaires..." @rm -f $(OBJETS) $(EXEC_O) @rm -f *~ *# @rm -f $(EXEC) @rm -f dependances @rm -f *.log @echo "Termine." depend: @echo "Creation des dependances..." @sed -e "/^# DEPENDANCES/,$$ d" makefile > dependances @echo "# DEPENDANCES" >> dependances @for i in $(OBJETS_O); do \ $(CC) -MM -MT $$i $(CCFLAGS) `echo $$i | sed "s/\(.*\)\\.o$$/\1.c/"` >> dependances; \ done @cat dependances > makefile @rm dependances @echo "Termine." rmlog: @echo "Suppresion des fichiers de log" @rm -f *.log @echo "Termine." # # CREATION ARCHIVE # ARCHIVE_FILES = * archive: clean @echo "Creation de l'archive $(NOM_PROJET)$(shell date '+%y%m%d.tar.gz')..." @REP=`basename "$$PWD"`; cd .. && tar zcf $(NOM_PROJET)$(shell date '+%y%m%d.tar.gz') $(addprefix "$$REP"/,$(ARCHIVE_FILES)) @echo "Termine." # DEPENDANCES str.o: str.c str.h json_parser.o: json_parser.c json.h str.h constante.h json_encoder.o: json_encoder.c json.h str.h constante.h json_array.o: json_array.c json.h str.h constante.h error.o: error.c str.h error.h arraylist.o: arraylist.c str.h arraylist.h constante.h server.h json.h server_tcp.o: server_tcp.c error.h server.h constante.h server_udp.o: server_udp.c error.h server.h constante.h bomberstudent_server.o: bomberstudent_server.c arraylist.h constante.h \ server.h json.h str.h bomberstudent_server.h client.h error.h handler.h \ game.h player.h client.o: client.c client.h constante.h server.h file.o: file.c error.h str.h file.h constante.h handler.o: handler.c error.h bomberstudent_server.h constante.h server.h \ json.h str.h client.h player.h handler.h game.h player.o: player.c player.h constante.h client.h server.h json.h str.h game.o: game.c error.h str.h file.h constante.h game.h player.h client.h \ server.h json.h bomberstudent_server.h delay.o: delay.c error.h delay.h constante.h game.h player.h client.h \ server.h json.h str.h object.o: object.c object.h constante.h main.o: main.c error.h bomberstudent_server.h constante.h server.h json.h \ str.h client.h main.h handler.h game.h player.h test.o: test.c json.h str.h constante.h arraylist.h server.h error.h \ bomberstudent_server.h client.h file.h game.h player.h