.PHONY: server clean all prod OUT=/tmp/2h FLAGS= CTF=$(patsubst %.md,$(OUT)/%.html,$(wildcard ctf/**/*.md)) all: $(OUT) $(OUT)/ctf $(CTF) $(OUT): pages templates static rootstatic build.py static/songlist.json build.py static/highlight.css python build.py -o $(OUT) $(FLAGS) touch $(OUT) $(OUT)/ctf: build.py python build.py -o $(OUT) ctf $(FLAGS) touch $(OUT)/ctf $(OUT)/ctf/%.html: ctf/%.md python build.py -o $(OUT) ctf -p $^ $(FLAGS) static/songlist.json: music build.py python build.py songlist $(FLAGS) static/highlight.css: build.py python build.py highlight $(FLAGS) server: all @trap 'kill 0' SIGINT; \ flask run & \ nginx -c $$(pwd)/nginx.conf -e stderr & \ wait clean: -rm -r $(OUT) prod: -rm -rf /var/www/u make OUT=/var/www/u -rm -rf /var/www/mu make OUT=/var/www/mu FLAGS=-m