summary refs log tree commit diff stats
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile80
1 files changed, 44 insertions, 36 deletions
diff --git a/makefile b/makefile index c6fc575..891de95 100644 --- a/makefile +++ b/makefile
@@ -7,8 +7,8 @@
7srcs := $(wildcard *.txt) 7srcs := $(wildcard *.txt)
8templates := $(wildcard _template.*) 8templates := $(wildcard _template.*)
9trunk := trunk 9trunk := trunk
10metas = hapax first-lines common-titles index 10metas = hapax first-lines common-titles index island
11metas += $(templates) 11metas += $(templates) $(wildcard _*)
12 12
13txts = $(filter-out \ 13txts = $(filter-out \
14 $(patsubst %,%.txt,$(metas)),\ 14 $(patsubst %,%.txt,$(metas)),\
@@ -44,6 +44,10 @@ backHead = $(trunk)/backlink.head
44backlinker = $(trunk)/backlink.sh 44backlinker = $(trunk)/backlink.sh
45backPandocOptions = --template=$(htmlTemplate) --smart 45backPandocOptions = --template=$(htmlTemplate) --smart
46 46
47islandHead = $(trunk)/island.head
48islandTxt = island.txt
49islandHtm = island.htm
50
47firstLinesTxt = first-lines.txt 51firstLinesTxt = first-lines.txt
48firstLinesOut = first-lines.html 52firstLinesOut = first-lines.html
49firstLiner = $(trunk)/first-lines.sh 53firstLiner = $(trunk)/first-lines.sh
@@ -53,67 +57,71 @@ commonTitlesOut = common-titles.html
53commonTitler = $(trunk)/common-titles.sh 57commonTitler = $(trunk)/common-titles.sh
54commonTitlesHead = $(trunk)/common-titles.head 58commonTitlesHead = $(trunk)/common-titles.head
55# }}} 59# }}}
56 60# PHONY {{{
57.PHONY: all 61.PHONY: all clean nuke again meta
58all: $(hapaxOut) $(firstLinesOut) $(commonTitlesOut)\ 62all: meta \
59 $(htmlPre) $(htmls) $(lozengeOut)\ 63 $(htmlPre) $(htmls) $(lozengeOut)\
60 $(backTxts) $(backHtms) 64 $(backHtms) $(islandHtm)
61 65
66clean:
67 -rm -f $(hapaxs) $(hapaxOut)
68 -rm -f $(firstLinesOut) $(firstLinesTxt)
69 -rm -f $(commonTitlesOut) $(commonTitlesTxt)
70 -rm -f $(htmls)
71 -rm -f $(backTxts) $(backHtms)
72 -rm -f *.tmp trunk/*.tmp
73
74nuke: clean
75 -rm -f $(hapaxPre) $(htmlPre)
76
77again: clean all
78
79meta: $(hapaxOut) $(firstLinesOut) $(commonTitlesOut)
80# }}}
62# HTML {{{ 81# HTML {{{
63$(htmlPre): $(htmlPreSrc) 82$(htmlPre): $(htmlPreSrc)
64 ghc --make $(htmlPreSrc) 83 ghc --make $(htmlPreSrc)
65 84
66%.html: %.txt | $(htmlTemplate) $(htmlPre) 85%.html: %.txt $(htmlTemplate) $(htmlPre)
67 pandoc $< -t html5 $(htmlPandocOptions) -o $@ 86 pandoc $< -t html5 $(htmlPandocOptions) -o $@
68 87
69$(lozengeOut): $(htmls) 88$(lozengeOut): $(htmls)
70 @bash $(lozenger) $(lozengeOut) $(htmls) 89 bash $(lozenger) $(lozengeOut) $(htmls)
71# }}} 90# }}}
72# BACKLINKS {{{ 91# BACKLINKS {{{
73%.back: %.html | $(backHead) 92%.back: %.html $(backHead)
74 @bash $(backlinker) $< $@ $(backHead) $(htmls) 93 @bash $(backlinker) $< $@ $(backHead) $(islandHead) $(txts)
75 94
76%_backlinks.htm: %.back | $(htmlTemplate) 95%_backlinks.htm: %.back
77 pandoc $< -t html5 $(backPandocOptions) -o $@ 96 pandoc $< -t html5 $(backPandocOptions) -o $@
97
98$(islandTxt): $(backTxts)
99
100$(islandHtm): $(islandTxt) $(islandHead) $(backHtms)
101 pandoc $< -t html5 $(htmlPandocOptions) -o $@
102 rm -f $(islandTxt)
78# }}} 103# }}}
79# HAPAX {{{ 104# HAPAX {{{
80$(hapaxPre): $(hapaxPreSrc) 105$(hapaxPre): $(hapaxPreSrc)
81 ghc --make $(hapaxPreSrc) 106 ghc --make $(hapaxPreSrc)
82 107
83%.hapax: %.txt | $(hapaxPre) 108%.hapax: %.txt $(hapaxPre) $(hapaxLinker) $(hapaxHead)
84 pandoc $< -t $(hapaxer) $(hapaxPandocOptions) -o $@ 109 pandoc $< -t $(hapaxer) $(hapaxPandocOptions) -o $@
85 110
86$(hapaxOut): $(hapaxs) | $(hapaxPre) $(hapaxLinker) $(hapaxHead) 111$(hapaxOut): $(hapaxs)
87 pandoc $^ -t $(hapaxer) -o $(hapaxOut) 112 pandoc $^ -t $(hapaxer) -o $@
88 @bash $(hapaxLinker) $@ $(hapaxHead) $^ 113 bash $(hapaxLinker) $@ $(hapaxHead) $^
89# }}} 114# }}}
90# FIRST LINES & COMMON TITLES {{{ 115# FIRST LINES & COMMON TITLES {{{
91$(firstLinesTxt): $(txts) | $(firstLiner) $(firstLinesHead) 116$(firstLinesTxt): $(txts) | $(firstLiner) $(firstLinesHead)
92 @bash $(firstLiner) $@ $(firstLinesHead) $^ 117 bash $(firstLiner) $@ $(firstLinesHead) $^
93 118
94$(firstLinesOut): $(firstLinesTxt) | $(htmlTemplate) $(htmlPre) 119$(firstLinesOut): $(firstLinesTxt) $(htmlTemplate) $(htmlPre)
95 pandoc $< -t html5 $(htmlPandocOptions) -o $@ 120 pandoc $< -t html5 $(htmlPandocOptions) -o $@
96 121
97$(commonTitlesTxt): $(txts) | $(commonTitler) $(commonTitlesHead) 122$(commonTitlesTxt): $(txts) | $(commonTitler) $(commonTitlesHead)
98 @bash $(commonTitler) $@ $(commonTitlesHead) $^ 123 bash $(commonTitler) $@ $(commonTitlesHead) $^
99 124
100$(commonTitlesOut): $(commonTitlesTxt) | $(htmlTemplate) $(htmlPre) 125$(commonTitlesOut): $(commonTitlesTxt) $(htmlTemplate) $(htmlPre)
101 pandoc $< -t html5 $(htmlPandocOptions) -o $@ 126 pandoc $< -t html5 $(htmlPandocOptions) -o $@
102# }}} 127# }}}
103# CLEAN {{{
104.PHONY: clean
105clean:
106 -rm -f $(hapaxs) $(hapaxOut)
107 -rm -f $(firstLinesOut) $(firstLinesTxt)
108 -rm -f $(commonTitlesOut) $(commonTitlesTxt)
109 -rm -f $(htmls)
110 -rm -f $(backHtms)
111 -rm -f *.tmp trunk/*.tmp
112
113.PHONY: nuke
114nuke: clean
115 -rm -f $(hapaxPre) $(htmlPre)
116
117.PHONY: again
118again: clean all
119# }}}