summary refs log tree commit diff stats
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/makefile b/makefile new file mode 100644 index 0000000..34eda34 --- /dev/null +++ b/makefile
@@ -0,0 +1,41 @@
1# Produce HTML & RIVER outputs with pandoc
2# Case Duckworth | autocento.me
3# inspired by Lincoln Mullen | lincolnmullen.com
4
5# Define directories, file lists, and options
6HTMLs := $(patsubst %.txt,%.html,$(wildcard *.txt))
7HTMopts = --template=.template.html
8HTMopts+= --smart --mathml --section-divs
9RIVERer = lua/river.lua
10RIVERs := $(patsubst %.txt,%.river,$(wildcard *.txt))
11RIVopts =
12LOZENGE = js/lozenge.js
13
14# Do everything
15.PHONY: all html river lozenge
16all : html river lozenge
17html : $(HTMLs)
18river : $(RIVERs)
19lozenge : $(LOZENGE)
20
21# Generic rule for HTML targets and Markdown sources
22%.html : %.txt
23 pandoc $< -f markdown -t html5 $(HTMopts) -o $@
24
25# Generic rule for RIVER targets and Markdown sources
26%.river : %.txt
27 @echo River-ing $@
28 @sed -e '/^---$$/,/^...$$/d'\
29 -e "s/[^][A-Za-z0-9\/\"':.-]/ /g" $< |\
30 pandoc - -f markdown -t $(RIVERer) $(RIVopts) -o $@
31
32$(LOZENGE) : $(HTMLs)
33 @echo "Updating lozenge.js..."
34 @list=`ls *.html |\
35 sed -e 's,../,,g' |\
36 tr '\n' ' ' |\
37 sed -e 's/\(\S\+.html\) /"\1",/g'\
38 -e 's/^\(.*\),$$/var files=[\1]/'` &&\
39 sed -i "s/var files=.*/$$list/" $(LOZENGE)
40# TODO: add compiling hapax
41# TODO: add first line compiler