This repository has been archived on 2023-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
iaj/TP2/Makefile
2023-04-11 16:30:26 +02:00

74 lines
1.8 KiB
Makefile

CXX = g++
CXXFLAGS = -std=c++11
RM = rm -rf
RAPPORT_DIR = Rapport
SLIDES_DIR = Rapport/presentation
EXCLUSIONS = README.* $(RAPPORT_DIR)
$(foreach i, $(EXCLUSIONS), $(eval TAR_EXCLUDE = $(TAR_EXCLUDE) --exclude="$(i)"))
NAME = TP2 - Groupe 4
TAR = tar -czf
RAPPORT = $(RAPPORT_DIR)/*.pdf
SLIDES = $(SLIDES_DIR)/*.pdf
CP = rsync -r $(TAR_EXCLUDE)
MV = mv
MKDIR = mkdir -p
TMP_DIR = temp
SOURCES_RAND = $(filter-out src/mcts_player.cpp, $(wildcard src/*.cpp))
OBJETS_RAND = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES_RAND)))
EXE_RAND = rand_player
SOURCES_MCTS = $(filter-out src/rand_player.cpp, $(wildcard src/*.cpp))
OBJETS_MCTS = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES_MCTS)))
EXE_MCTS = mcts_player
STATS_DIR = new_stats
%.cpp.o: src/%.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEVFLAGS)
all: default
default: mcts_player rand_player
nj: mcts_player
rand_player: CXXFLAGS += -Wall -O2
rand_player: compilation_rand
mcts_player: CXXFLAGS += -Wall -O2
mcts_player: compilation_mcts
dev: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -Og -g
dev: CXXFLAGS += -Wold-style-cast -Wsign-conversion
dev: compilation_mcts
compilation_rand: $(OBJETS_RAND)
$(CXX) -o $(EXE_RAND) $(OBJETS_RAND)
compilation_mcts: $(OBJETS_MCTS)
$(CXX) -o $(EXE_MCTS) $(OBJETS_MCTS)
tgz:
$(MAKE) clean
$(CP) * $(TMP_DIR)
$(MKDIR) $(TMP_DIR)/$(SLIDES_DIR)
$(CP) $(RAPPORT) temp/$(RAPPORT_DIR)
$(CP) $(SLIDES) $(TMP_DIR)/$(SLIDES_DIR)
cd $(TMP_DIR) && \
$(TAR) "$(NAME).tar.gz" * && \
$(MV) "$(NAME).tar.gz" ..
$(RM) $(TMP_DIR)/
clean:
$(RM) $(OBJETS_RAND) $(EXE_RAND) $(OBJETS_MCTS) $(EXE_MCTS)
$(RM) *.tar.gz
$(RM) $(TMP_DIR)
stats:
./mk_stats.sh
clean-stats:
$(RM) $(STATS_DIR)