moth/Makefile

81 lines
2.2 KiB
Makefile
Raw Normal View History

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
2010-05-15 12:12:43 -06:00
PYTHON = python
2010-05-15 10:32:13 -06:00
BUILD_DIR = build
2010-03-02 22:18:13 -07:00
TEMPLATE = $(CURDIR)/template.html
MDWNTOHTML = $(CURDIR)/mdwntohtml.py --template=$(TEMPLATE) --base=$(BASE_URL)
default: install
TARGETS = puzzles
2010-05-15 10:32:13 -06:00
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:45:47 -06:00
puzzles: puzzles/.git
puzzles/.git:
2010-05-15 10:32:13 -06:00
git submodule update --init
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 \
2010-05-15 17:08:03 -06:00
--htmldir=$(DESTDIR)$(WWW)/puzzler \
--keyfile=$(DESTDIR)$(LIB)/puzzler.keys
2010-05-15 10:32:13 -06:00
puzzles-clean:
2010-05-15 17:08:03 -06:00
rm -rf $(BUILD_DIR)/puzzles $(DESTDIR)$(WWW)/puzzler $(DESTDIR)$(LIB)/puzzler.keys
2010-05-15 10:32:13 -06:00
2010-05-15 10:34:17 -06:00
install: $(INSTALL_TARGETS)
2010-05-15 17:08:03 -06:00
install bin/pointscli $(DESTDIR)$(BIN)
install bin/in.pointsd bin/in.flagd \
2010-05-15 17:48:33 -06:00
bin/kevin bin/badmathbot \
2010-05-15 10:47:59 -06:00
bin/scoreboard \
2010-05-15 17:08:03 -06:00
bin/run-ctf $(DESTDIR)$(SBIN)
cp -r lib/* $(DESTDIR)$(LIB)
cp -r www/* $(DESTDIR)$(WWW)
cp template.html $(DESTDIR)$(LIB)
2010-05-15 17:21:47 -06:00
install --directory $(DESTDIR)$(VAR)/disabled
2010-03-02 22:18:13 -07:00
2010-05-15 17:25:02 -06:00
$(PYTHON) setup.py install --prefix=$(DESTDIR)$(BASE)
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:
2010-05-15 17:08:03 -06:00
install --directory $(DESTDIR)$(LIB) $(DESTDIR)$(BIN) $(DESTDIR)$(SBIN)
install --directory $(DESTDIR)$(VAR)
install --directory $(DESTDIR)$(WWW)
install --directory $(DESTDIR)$(WWW)/puzzler
install --directory $(DESTDIR)$(VAR)/points
install --directory $(DESTDIR)$(VAR)/points/tmp
install --directory $(DESTDIR)$(VAR)/points/cur
install --directory $(DESTDIR)$(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
uninstall:
2010-05-15 17:08:03 -06:00
rm -rf $(DESTDIR)$(VAR) $(DESTDIR)$(WWW) $(DESTDIR)$(LIB)
rm -rf $(DESTDIR)$(BIN) $(DESTDIR)$(SBIN)
rmdir $(DESTDIR)$(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