2010-03-02 20:45:21 -07:00
|
|
|
BASE = /opt/ctf
|
|
|
|
VAR = $(BASE)/var
|
|
|
|
WWW = $(BASE)/www
|
|
|
|
LIB = $(BASE)/lib
|
|
|
|
BIN = $(BASE)/bin
|
|
|
|
SBIN = $(BASE)/sbin
|
2010-03-02 23:10:26 -07:00
|
|
|
BASE_URL = /
|
2010-05-15 10:32:13 -06:00
|
|
|
|
|
|
|
BUILD_DIR = build
|
2010-03-02 20:45:21 -07:00
|
|
|
|
2010-03-02 22:18:13 -07:00
|
|
|
TEMPLATE = $(CURDIR)/template.html
|
|
|
|
MDWNTOHTML = $(CURDIR)/mdwntohtml.py --template=$(TEMPLATE) --base=$(BASE_URL)
|
|
|
|
|
|
|
|
default: install
|
2010-03-02 20:45:21 -07:00
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
TARGETS = tanks puzzles
|
|
|
|
include $(wildcard */*.mk)
|
|
|
|
CLEAN_TARGETS = $(addsuffix -clean, $(TARGETS))
|
|
|
|
INSTALL_TARGETS = $(addsuffix -install, $(TARGETS))
|
|
|
|
.PHONY: $(CLEAN_TARGETS) $(INSTALL_TARGETS)
|
2010-03-02 22:18:13 -07:00
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
puzzles:
|
|
|
|
git submodule update --init
|
2010-03-02 20:45:21 -07:00
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
puzzles-build: puzzles
|
|
|
|
mkdir -p $(BUILD_DIR)/puzzles
|
|
|
|
$(MAKE) -C puzzles BUILD_DIR=$(abspath $(BUILD_DIR)/puzzles)
|
|
|
|
|
|
|
|
puzzles-install: puzzles-build
|
|
|
|
./mkpuzzles.py --base=$(BASE_URL) --puzzles=$(BUILD_DIR)/puzzles \
|
|
|
|
--htmldir=$(WWW)/puzzler --keyfile=$(LIB)/puzzler.keys
|
|
|
|
|
|
|
|
puzzles-clean:
|
|
|
|
rm -rf $(BUILD_DIR)/puzzles $(WWW)/puzzler $(LIB)/puzzler.keys
|
|
|
|
|
|
|
|
tanks-install:
|
|
|
|
install --directory $(VAR)/tanks
|
|
|
|
install --directory $(VAR)/tanks/results
|
|
|
|
install --directory $(VAR)/tanks/errors
|
|
|
|
install --directory $(VAR)/tanks/ai
|
|
|
|
install --directory $(VAR)/tanks/ai/players
|
|
|
|
install --directory $(VAR)/tanks/ai/house
|
|
|
|
|
|
|
|
ln -sf $(VAR)/tanks/results $(WWW)/tanks/results
|
2010-03-02 20:45:21 -07:00
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
install bin/run-tanks $(SBIN)
|
|
|
|
|
|
|
|
tanks-clean:
|
|
|
|
rm -rf $(VAR)/tanks
|
|
|
|
rm -rf $(WWW)/tanks
|
|
|
|
|
2010-05-15 10:34:17 -06:00
|
|
|
install: $(INSTALL_TARGETS)
|
2010-03-02 20:45:21 -07:00
|
|
|
install bin/pointscli $(BIN)
|
|
|
|
install bin/in.pointsd bin/in.flagd \
|
2010-05-15 10:34:17 -06:00
|
|
|
VAR bin/scoreboard \
|
2010-03-02 20:45:21 -07:00
|
|
|
bin/run-ctf $(SBIN)
|
|
|
|
cp -r lib/* $(LIB)
|
|
|
|
cp -r www/* $(WWW)
|
|
|
|
cp template.html $(LIB)
|
|
|
|
|
2010-03-02 22:18:13 -07:00
|
|
|
install --directory $(VAR)/disabled
|
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
python setup.py install --prefix=$(BASE)
|
2010-03-06 23:29:01 -07:00
|
|
|
|
2010-03-02 22:18:13 -07:00
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
$(INSTALL_TARGETS): base-install
|
2010-03-02 22:18:13 -07:00
|
|
|
base-install:
|
|
|
|
install --directory $(LIB) $(BIN) $(SBIN)
|
2010-05-15 10:32:13 -06:00
|
|
|
install --directory $(VAR)
|
|
|
|
install --directory $(WWW)
|
|
|
|
install --directory $(WWW)/puzzler
|
|
|
|
install --directory $(VAR)/points
|
|
|
|
install --directory $(VAR)/points/tmp
|
|
|
|
install --directory $(VAR)/points/cur
|
|
|
|
install --directory $(VAR)/flags
|
2010-03-02 22:18:13 -07:00
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
echo 'VAR = "$(VAR)"' > ctf/paths.py
|
|
|
|
echo 'WWW = "$(WWW)"' >> ctf/paths.py
|
|
|
|
echo 'LIB = "$(LIB)"' >> ctf/paths.py
|
|
|
|
echo 'BIN = "$(BIN)"' >> ctf/paths.py
|
|
|
|
echo 'SBIN = "$(SBIN)"' >> ctf/paths.py
|
|
|
|
echo 'BASE_URL = "$(BASE_URL)"' >> ctf/paths.py
|
2010-03-02 20:45:21 -07:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -rf $(VAR) $(WWW) $(LIB) $(BIN) $(SBIN)
|
|
|
|
rmdir $(BASE) || true
|
2010-03-02 22:18:13 -07:00
|
|
|
|
|
|
|
|
2010-05-15 10:32:13 -06:00
|
|
|
clean: $(CLEAN_TARGETS)
|
|
|
|
$(MAKE) -C puzzles BUILD_DIR=$(abspath $(BUILD_DIR)/puzzles) clean
|
|
|
|
|