add rel="alternate" links to articles and indices
[~bandali/bndl.org] / GNUmakefile
CommitLineData
d3adcff4
AB
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
ce2fcdbc 11gen-html = perl txt2html $(1) < $< > $@
d3adcff4
AB
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))
17
18TXT_FA := $(filter-out fa/bandali.fa.txt,$(wildcard fa/*.fa.txt))
19OUT_FA := $(patsubst fa/%.fa.txt,fa/%.html,$(TXT_FA))
20OUT_FA := $(patsubst fa/bandali-%.html,fa/%.html,$(OUT_FA))
21
22all: $(OUT) $(OUT_FA) index.html fa/index.html
23
ce2fcdbc
AB
24%.html: bandali-%.txt; $(gen-html)
25%.html: %.txt; $(gen-html)
26index.html: bandali.txt; $(call gen-html,--index)
d3adcff4 27
ce2fcdbc
AB
28fa/%.html: fa/bandali-%.fa.txt; $(call gen-html,--lang='fa')
29fa/%.html: fa/%.fa.txt; $(call gen-html,--lang='fa')
30fa/index.html: fa/bandali.fa.txt; $(call gen-html,--lang='fa' --index)
d3adcff4
AB
31
32
33clean:
34 rm -f $(OUT) $(OUT_FA) index.html fa/index.html
35
36serve:
37 python -m http.server $(port) || python -m SimpleHTTPServer $(port)
38
39watch:
40 while true; do \
41 echo $(TXT) $(TXT_FA) bandali.txt fa/bandali.fa.txt \
42 GNUmakefile txt2html | tr " " "\n" | entr -d make; done
43
44.PHONY: all clean serve watch