123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #
- # CONFIGURATION GENERALE
- #
- EXEC = main
- OBJETS = str.o json_parser.o json_encoder.o error.o arraylist.o server_tcp.o server_udp.o bomberstudent_server.o client.o
- NOM_PROJET = Porjet 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
- 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 error.h
- client.o: client.c client.h constante.h server.h
- main.o: main.c json.h str.h constante.h arraylist.h server.h error.h \
- bomberstudent_server.h
|