Files: df8c0d25c35c9792c466c8fdc5979c1dd7d92766 / Makefile
1600 bytesRaw
1 | .PHONY: lint clean check-publish publish serve |
2 | |
3 | output: $(shell find content static) .cache/generator .cache/fonts .cache/lint |
4 | python generator/generate.py |
5 | touch $@ |
6 | |
7 | .cache/generator: $(shell find generator) .cache/deps |
8 | python -m black . |
9 | touch $@ |
10 | |
11 | .cache/deps: Makefile |
12 | toolbox run echo || toolbox -y create |
13 | toolbox run sh -c 'which npx || sudo dnf -y install npm' |
14 | toolbox run sh -c 'which pip || sudo dnf -y install pip' |
15 | toolbox run pip install black |
16 | toolbox run pip install beautifulsoup4==4.9.3 |
17 | toolbox run pip install marko==1.1.0 |
18 | toolbox run pip install python-frontmatter==1.0.0 |
19 | mkdir -p .cache |
20 | touch $@ |
21 | |
22 | .cache/fonts: $(shell find ~/Software/src/Iosevka/dist/*/WOFF2/) ~/Software/src/smol-emoji/SmolEmoji-Regular.otf |
23 | touch $@ |
24 | |
25 | lint: .cache/lint |
26 | |
27 | .cache/lint: $(shell find static/style) .cache/deps |
28 | toolbox run npx -y prettier -w static/ |
29 | touch $@ |
30 | |
31 | clean: .cache/clean |
32 | |
33 | .cache/clean: $(shell find output/*) |
34 | rm -r output |
35 | touch $@ |
36 | |
37 | check-publish: |
38 | ifeq "${SSHUSER}" "" |
39 | @echo "SSHUSER is undefined" |
40 | @exit 1 |
41 | else ifeq "${SSHPASS}" "" |
42 | @echo "SSHPASS is undefined" |
43 | @exit 1 |
44 | else ifeq "${SSHDIR}" "" |
45 | @echo "SSHDIR is undefined" |
46 | @exit 1 |
47 | else ifeq "${SSHPORT}" "" |
48 | @echo "SSHPORT is undefined" |
49 | @exit 1 |
50 | else ifneq "$(shell git status --porcelain)" "" |
51 | @echo "Uncommitted changes:" |
52 | @git status --porcelain |
53 | @exit 1 |
54 | endif |
55 | |
56 | publish: clean check-publish .cache/publish |
57 | |
58 | .cache/publish: output |
59 | echo -e "cd ${SSHDIR} \n put -r output/* \n exit" | \ |
60 | sshpass -e sftp -oBatchMode=no -b - sftp://${SSHUSER}@gkn.me.uk:${SSHPORT} |
61 | touch $@ |
62 | |
63 | serve: output |
64 | cd output && python -m http.server |
65 |
Built with git-ssb-web