.PHONY: server clean all prod OUT=/tmp/2h FLAGS= CTF=$(patsubst %.md,$(OUT)/%.html,$(wildcard ctf/**/*.md)) KATEX_PATH=$(shell nix path-info nixpkgs#nodePackages.katex)/lib/node_modules/katex/dist 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 build.py 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) static/katex.min.css: ln -sf "$(KATEX_PATH)"/katex.min.css static/katex.min.css static/fonts: ln -sf "$(KATEX_PATH)"/fonts static/fonts server: all @trap 'kill 0' SIGINT; \ flask run & \ nginx -c $$(pwd)/nginx.conf -e stderr & \ (inotifywait -qmre modify ctf pages | while IFS=$$'\n' read line; do echo "$$line"; make; done) & \ 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