Skip to content
Snippets Groups Projects
Commit 27ce2593 authored by ERKEN EFE's avatar ERKEN EFE
Browse files

:pencil: DOC: Add commentary, structure to makefile

Makefile is now easier to read. Also added more clean targets.
parent f86b5ab7
Branches
Tags
No related merge requests found
##### Commun
CC = gcc
CPPFLAGS = -I include
# L'option de debug -g à enlever
CFLAGS = -Wall -Wextra -g
LDFLAGS =
LDLIBS = -lncurses
DEPFLAGS = -MT $@ -MMD -MP -MF $(DPATH)$*.Td
POSTCOMPILE = mv -f $(DPATH)$*.Td $(DPATH)$*.d && touch $@
##### Chemins
SPATH = src/
HPATH = include/
OPATH = obj/
DPATH = dep/
LEVELPATH = levels/
##### Executables
TEST_EXEC = sokoban_test
EXEC = sokoban
##### Options
CPPFLAGS = -I include
### L'option de debug -g à enlever
CFLAGS = -Wall -Wextra -g
LDFLAGS =
LDLIBS = -lncurses
DEPFLAGS = -MT $@ -MMD -MP -MF $(DPATH)$*.Td
##### Fichiers
ALL_SOURCES = $(wildcard $(SPATH)*.c)
TEST_SOURCES = $(filter-out $(SPATH)main.c, $(ALL_SOURCES))
SOURCES = $(filter-out $(SPATH)test.c, $(ALL_SOURCES))
......@@ -20,16 +30,24 @@ TEST_OBJECTS = $(addprefix $(OPATH),$(patsubst %.c,%.o,$(notdir $(TEST_SOURCES)
OBJECTS = $(addprefix $(OPATH),$(patsubst %.c,%.o,$(notdir $(SOURCES))))
ALL_DEPENDS = $(addprefix $(DPATH),$(patsubst %.c,%.d,$(notdir $(ALL_SOURCES))))
LEVELS = $(wildcard $(LEVELPATH)level*.txt)
##### Générateur de documentation
DOCGEN = doxygen
DOXYFILE = doc/Doxyfile
DOCPATH = doc/doxygen
##### Générateur d'archive
ARCHIVE_NAME = ERKEN_Efe.tar.gz
ARCHIVE_SOURCES = $(SOURCES) $(HEADERS) makefile $(LEVELS) README.md $(DOXYFILE)
ARCHIVER = tar
ARCHIVE_FLAGS = -cvzf
TEST_EXEC = sokoban_test
EXEC = sokoban
.PHONY : all test clean doc archive
##### Divers
### Protection contre interruption lors de la compilation
POSTCOMPILE = mv -f $(DPATH)$*.Td $(DPATH)$*.d && touch $@
##### Règles de construction
.PHONY : all test clean cleandoc cleanarchive cleanall doc archive
all : $(EXEC)
......@@ -53,12 +71,25 @@ $(DPATH) :
$(ALL_DEPENDS) :
### Un des deux, c'est la même chose
# include $(wildcard $(ALL_DEPENDS))
-include $(ALL_DEPENDS)
clean :
rm -f $(EXEC) $(TEST_EXEC) $(ALL_OBJECTS) $(ALL_DEPENDS)
cleandoc :
rm -rf $(DOCPATH)
cleanarchive :
rm -f $(ARCHIVE_NAME)
cleanall : clean
cleanall : cleandoc
cleanall : cleanarchive
cleanall :
rm -rf $(OPATH) $(DPATH)
doc :
$(DOCGEN) $(DOXYFILE)
......@@ -66,4 +97,3 @@ archive : $(ARCHIVE_NAME)
$(ARCHIVE_NAME) : $(ARCHIVE_SOURCES)
$(ARCHIVER) $(ARCHIVE_FLAGS) $@ $^
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment