bandali(.fa).txt: link to atom and rss feeds
[~bandali/bndl.org] / GNUmakefile
... / ...
CommitLineData
1# GNUmakefile --- GNU Makefile for building my personal site
2
3# Copyright (c) 2020-2021 bandali
4#
5# Copying and distribution of this file, with or without modification,
6# are permitted in any medium without royalty provided the copyright
7# notice and this notice are preserved. This file is offered as-is,
8# without any warranty.
9
10
11gen = perl txt2pre $(1) < $< > $@
12port := $(if $(port),$(port),8000)
13
14TXT := $(filter-out bandali-pubkey.txt bandali.txt,$(wildcard *.txt))
15OUT := $(patsubst %.txt,%.html,$(TXT))
16OUT := $(patsubst bandali-%.html,%.html,$(OUT))
17FEEDS := notes.atom notes.rss
18NOTES := $\
19libreplanet-2021.txt $\
20fsf-internship-beyond.txt $\
21fsf-internship-intro.txt $\
22bandali-computing.txt $\
23
24TXT_FA := $(filter-out fa/bandali.fa.txt,$(wildcard fa/*.fa.txt))
25OUT_FA := $(patsubst fa/%.fa.txt,fa/%.html,$(TXT_FA))
26OUT_FA := $(patsubst fa/bandali-%.html,fa/%.html,$(OUT_FA))
27FEEDS_FA := fa/notes.atom fa/notes.rss
28NOTES_FA := $\
29fa/fsf-internship-beyond.fa.txt $\
30fa/fsf-internship-intro.fa.txt $\
31fa/bandali-computing.fa.txt $\
32
33all: $(OUT) $(FEEDS) index.html $(OUT_FA) $(FEEDS_FA) fa/index.html
34
35%.html: bandali-%.txt txt2pre; $(gen)
36%.html: %.txt txt2pre; $(gen)
37index.html: bandali.txt txt2pre; $(call gen,--index)
38notes.%: $(NOTES) txt2pre
39 perl txt2pre --index --header --format='$*' > $@
40 for n in $(NOTES); do perl txt2pre --format='$*' < "$$n" >> $@; done
41 perl txt2pre --index --footer --format='$*' >> $@
42
43fa/%.html: fa/bandali-%.fa.txt txt2pre; $(call gen,--lang='fa')
44fa/%.html: fa/%.fa.txt txt2pre; $(call gen,--lang='fa')
45fa/index.html: fa/bandali.fa.txt txt2pre; $(call gen,--lang='fa' --index)
46fa/notes.%: $(NOTES_FA) txt2pre
47 perl txt2pre --lang='fa' --index --header --format='$*' > $@
48 for n in $(NOTES_FA); do perl txt2pre --lang='fa' --format='$*' < "$$n" >> $@; done
49 perl txt2pre --lang='fa' --index --footer --format='$*' >> $@
50
51
52clean:
53 rm -f $(OUT) $(OUT_FA) index.html fa/index.html
54
55serve:
56 python -m http.server $(port) || python -m SimpleHTTPServer $(port)
57
58watch:
59 while true; do \
60 echo $(TXT) $(TXT_FA) bandali.txt fa/bandali.fa.txt \
61 GNUmakefile txt2pre | tr " " "\n" | entr -d make; done
62
63.PHONY: all clean serve watch