1 # GNUmakefile --- GNU Makefile for building my personal site
3 # Copyright (c) 2020-2021 bandali
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.
11 gen-html
= perl txt2pre
$(1) < $< > $@
12 port
:= $(if
$(port
),$(port
),8000)
14 TXT
:= $(filter-out bandali-pubkey.txt bandali.txt
,$(wildcard *.txt
))
15 OUT
:= $(patsubst %.txt
,%.html
,$(TXT
))
16 OUT
:= $(patsubst bandali-
%.html
,%.html
,$(OUT
))
18 TXT_FA
:= $(filter-out fa
/bandali.fa.txt
,$(wildcard fa
/*.fa.txt
))
19 OUT_FA
:= $(patsubst fa
/%.fa.txt
,fa
/%.html
,$(TXT_FA
))
20 OUT_FA
:= $(patsubst fa
/bandali-
%.html
,fa
/%.html
,$(OUT_FA
))
22 all: $(OUT
) $(OUT_FA
) index.html fa
/index.html
24 %.html
: bandali-
%.txt
; $(gen-html
)
25 %.html
: %.txt
; $(gen-html
)
26 index.html
: bandali.txt
; $(call gen-html
,--index
)
28 fa
/%.html
: fa
/bandali-
%.fa.txt
; $(call gen-html
,--lang
='fa')
29 fa
/%.html
: fa
/%.fa.txt
; $(call gen-html
,--lang
='fa')
30 fa
/index.html
: fa
/bandali.fa.txt
; $(call gen-html
,--lang
='fa' --index
)
34 rm -f
$(OUT
) $(OUT_FA
) index.html fa
/index.html
37 python
-m http.server
$(port
) || python
-m SimpleHTTPServer
$(port
)
41 echo
$(TXT
) $(TXT_FA
) bandali.txt fa
/bandali.fa.txt \
42 GNUmakefile txt2pre | tr
" " "\n" | entr
-d make
; done
44 .PHONY
: all clean serve watch