u.twoha.cc/Makefile

49 lines
1.1 KiB
Makefile
Raw Normal View History

2024-09-13 03:24:53 -04:00
.PHONY: server clean all prod
OUT=/tmp/2h
FLAGS=
CTF=$(patsubst %.md,$(OUT)/%.html,$(wildcard ctf/**/*.md))
2024-10-01 01:01:04 -04:00
KATEX_PATH=$(shell nix path-info nixpkgs#nodePackages.katex)/lib/node_modules/katex/dist
2024-09-13 03:24:53 -04:00
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
2024-09-26 20:29:58 -04:00
$(OUT)/ctf/%.html: ctf/%.md build.py
python build.py -o $(OUT) ctf -p $< $(FLAGS)
2024-09-13 03:24:53 -04:00
static/songlist.json: music build.py
python build.py songlist $(FLAGS)
static/highlight.css: build.py
python build.py highlight $(FLAGS)
2024-10-01 01:01:04 -04:00
static/katex.min.css:
ln -sf "$(KATEX_PATH)"/katex.min.css static/katex.min.css
static/fonts:
ln -sf "$(KATEX_PATH)"/fonts static/fonts
2024-09-13 03:24:53 -04:00
server: all
2024-09-19 21:25:53 -04:00
@trap 'kill 0' SIGINT; \
flask run & \
nginx -c $$(pwd)/nginx.conf -e stderr & \
2024-09-22 18:43:10 -04:00
(inotifywait -qmre modify ctf pages | while IFS=$$'\n' read line; do echo "$$line"; make; done) & \
2024-09-19 21:25:53 -04:00
wait
2024-09-13 03:24:53 -04:00
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