Add more warnings and add a release option
This commit is contained in:
parent
b052570c1c
commit
cac541a314
1 changed files with 49 additions and 30 deletions
45
Makefile
45
Makefile
|
@ -1,8 +1,6 @@
|
|||
# Makefile
|
||||
# Auteur : Farès BELHADJ
|
||||
# Email : amsi@up8.edu
|
||||
# Date : 16/11/2021
|
||||
# définition des commandes utilisées
|
||||
# Auteur : Farès BELHADJ (amsi@up8.edu)
|
||||
|
||||
# Définition des commandes utilisées
|
||||
CC = gcc
|
||||
ECHO = echo
|
||||
RM = rm -f
|
||||
|
@ -11,12 +9,14 @@ ZIP = zip
|
|||
MKDIR = mkdir
|
||||
CHMOD = chmod
|
||||
CP = rsync -R
|
||||
# déclaration des options du compilateur
|
||||
CFLAGS = -Wall -O3
|
||||
|
||||
# Déclaration des options du compilateur
|
||||
CFLAGS =
|
||||
CPPFLAGS = -I.
|
||||
LDFLAGS = -lm
|
||||
# définition des fichiers et dossiers
|
||||
PACKNAME = sc_00_07
|
||||
|
||||
# Définition des fichiers et dossiers
|
||||
PACKNAME = projet
|
||||
PROGNAME = demo
|
||||
VERSION = 1.0
|
||||
distdir = $(PACKNAME)_$(PROGNAME)-$(VERSION)
|
||||
|
@ -28,7 +28,8 @@ DOXYFILE = documentation/Doxyfile
|
|||
VSCFILES = $(PROGNAME).vcxproj $(PROGNAME).sln
|
||||
EXTRAFILES = COPYING $(wildcard shaders/*.?s images/*) $(VSCFILES)
|
||||
DISTFILES = $(SOURCES) Makefile $(HEADERS) $(DOXYFILE) $(EXTRAFILES)
|
||||
# Traitements automatiques pour ajout de chemins et options (ne pas modifier)
|
||||
|
||||
# Traitements automatiques pour ajout des chemins et options
|
||||
ifneq (,$(shell ls -d /usr/local/include 2>/dev/null | tail -n 1))
|
||||
CPPFLAGS += -I/usr/local/include
|
||||
endif
|
||||
|
@ -48,36 +49,54 @@ ifeq ($(shell uname),Darwin)
|
|||
else
|
||||
LDFLAGS += -lGL
|
||||
endif
|
||||
|
||||
CPPFLAGS += $(shell sdl2-config --cflags)
|
||||
LDFLAGS += -lGL4Dummies $(shell sdl2-config --libs)
|
||||
all: $(PROGNAME)
|
||||
$(PROGNAME): $(OBJ)
|
||||
$(CC) $(OBJ) $(LDFLAGS) -o $(PROGNAME)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# Par défaut
|
||||
$(PROGNAME): CFLAGS += -Wall -Wextra -Wshadow -pedantic -g -Wsign-conversion
|
||||
$(PROGNAME): compilation
|
||||
|
||||
# Version finale avec optimisation
|
||||
release: CFLAGS += -O3
|
||||
release: compilation
|
||||
|
||||
compilation: $(OBJ)
|
||||
$(CC) $(OBJ) $(LDFLAGS) -o $(PROGNAME)
|
||||
|
||||
dist: distdir
|
||||
$(CHMOD) -R a+r $(distdir)
|
||||
$(TAR) zcvf $(distdir).tgz $(distdir)
|
||||
$(RM) -r $(distdir)
|
||||
|
||||
zip: distdir
|
||||
$(CHMOD) -R a+r $(distdir)
|
||||
$(ZIP) -r $(distdir).zip $(distdir)
|
||||
$(RM) -r $(distdir)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(RM) -r $(distdir)
|
||||
$(MKDIR) $(distdir)
|
||||
$(CHMOD) 777 $(distdir)
|
||||
$(CP) $(DISTFILES) $(distdir)
|
||||
|
||||
doc: $(DOXYFILE)
|
||||
cat $< | sed -e "s/PROJECT_NAME *=.*/PROJECT_NAME = $(PROGNAME)/" |\
|
||||
sed -e "s/PROJECT_NUMBER *=.*/PROJECT_NUMBER = $(VERSION)/" >> $<.new
|
||||
mv -f $<.new $<
|
||||
cd documentation && doxygen && cd ..
|
||||
|
||||
msvc: $(VSCFILES)
|
||||
@echo "Now these files ($?) already exist. If you wish to regenerate them, you should first delete them manually."
|
||||
$(VSCFILES):
|
||||
@echo "Generating $@ ..."
|
||||
@cat ../../Windows/templates/gl4dSample$(suffix $@) | sed -e "s/INSERT_PROJECT_NAME/$(PROGNAME)/g" | sed -e "s/INSERT_TARGET_NAME/$(PROGNAME)/" | sed -e "s/INSERT_SOURCE_FILES/$(MSVCSRC)/" > $@
|
||||
|
||||
all: $(PROGNAME)
|
||||
|
||||
clean:
|
||||
@$(RM) -r $(PROGNAME) $(OBJ) *~ $(distdir).tgz $(distdir).zip gmon.out \
|
||||
core.* documentation/*~ shaders/*~ documentation/html
|
||||
|
|
Reference in a new issue