PraktikumOthello/Makefile

90 lines
1.9 KiB
Makefile

CXX?=clang++
CC?=clang
TARGETS = othello \
example-player \
random-player \
my-player
SRC_mcp = othello.cc mcp.cc
SRC_common = board.cc
ASM_common = asm.S
OBJECTS = $(SRC_mcp:.cc=.o) $(SRC_common:.cc=.o) \
$(ASM_common:.S=.o) \
players/example-player.o \
players/random-player.o \
players/my-player.o \
players/playerlib.o
CXXFLAGS += -std=c++11 -I. -g
ifeq ($(CXX),clang++)
CXXFLAGS += -Wno-disabled-macro-expansion
endif
ifeq ($(CXX),g++)
CXXFLAGS += -MMD -Wall
else
CXXFLAGS += -Weverything -Wno-padded -Wno-weak-vtables
endif
CFLAGS += -I. -g
all : $(TARGETS)
othello : $(SRC_common:.cc=.o) $(ASM_common:.S=.o)
othello : $(SRC_mcp:.cc=.o)
$(CXX) $^ -o $@ $(LDFLAGS)
example-player: players/example-player.o
$(CXX) $^ -o $@ $(LDFLAGS)
my-player : players/my-player.o
$(CXX) $^ -o $@ $(LDFLAGS)
random-player : players/random-player.o players/playerlib.o
$(CXX) $^ -o $@ $(LDFLAGS)
PLAYER1 ?= my-player
PLAYER2 ?= random-player
.PHONY : clean cleanall help
demo : $(TARGETS)
MCP_OPTS="-d" PLAYER1=example-player PLAYER2=example-player make execute
debug : $(TARGETS)
MCP_OPTS="-d" make execute
fight : $(TARGETS)
MCP_OPTS="-t 60 -T 61 -m 1024 -M 1024" make execute
execute : $(TARGETS)
./othello $(MCP_OPTS) $(PLAYER1) $(PLAYER2)
help :
@echo "Benutzung: [PLAYER1=<player1>] [PLAYER2=<player2>] make <Ziel>"
@echo ""
@echo "PLAYER1, PLAYER2 -> Dateien mit zu verwendenden Spielern."
@echo " Standardwerte: PLAYER1 = my-player"
@echo " PLAYER2 = random-player"
@echo ""
@echo "Mögliche Ziele:"
@echo ""
@echo "demo - startet ein Spiel mit dem example-player"
@echo "debug - startet ein Spiel im Debug-Modus (keine Zeitbeschränkung)"
@echo "fight - startet ein Turnier-Spiel"
clean :
$(RM) $(OBJECTS)
cleanall : clean
$(RM) $(TARGETS)
$(RM) $(OBJECTS:.o=.d)
-include $(OBJECTS:.o=.d)
-include Makefile.priv