123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #
- # CONFIGURATION GENERALE
- #
- EXEC = mysh
- OBJETS = str.o parser.o
- NOM_PROJET = mini-shell
- #
- # 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 =
- #
- # 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
- @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."
- #
- # 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
- parser.o: parser.c parser.h constante.h str.h
- mysh.o: mysh.c parser.h constante.h str.h mysh.h
|