summaryrefslogtreecommitdiff
path: root/Makefile
blob: 3f52318e93a2048037ed6ad93e5d969355a9cd70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
SHELL = bash
RUBYLIB=$(realpath .)/lib
export RUBYLIB

patsubst-all = $(if $1,$(call patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)

html.suffixes = md org erb
html.src = $(shell find src -type f \( -false $(foreach s,$(html.suffixes), -o -name '*.$s' -o -name '*.$s.m4' ) \) | grep -v /web/)
html.out = $(call patsubst-all,$(addprefix src/%.,$(html.suffixes)),out/%.html,$(patsubst %.m4,%,$(html.src)))
all: $(html.out)
all: out/style.css
all: out/header-path.svg

pagerender.deps = bin/pagerender lib/pandoc.rb lib/template.erb

out/%: src/%.m4
	mkdir -p -- $(@D)
	m4 -P < $< > $@
out/%: out/%.m4
	m4 -P < $< > $@

out/%.html: src/%.md $(pagerender.deps)
	mkdir -p -- $(@D)
	bin/pagerender $< > $@
out/%.html: out/%.md $(pagerender.deps)
	bin/pagerender $< > $@

out/%.html: src/%.org $(pagerender.deps)
	mkdir -p -- $(@D)
	bin/pagerender $< > $@
out/%.html: out/%.org $(pagerender.deps)
	bin/pagerender $< > $@

out/%.html: src/%.erb $(pagerender.deps)
	mkdir -p -- $(@D)
	bin/pagerender $< > $@
out/%.html: out/%.erb $(pagerender.deps)
	bin/pagerender $< > $@

var-%:
	@printf '%s\n' $(call quote.shell,$($*))

out/%.css: src/%.scss
	scss -s < $< > $@

.DELETE_ON_ERROR:
.SECONDARY:

outdir=out/logos
srcdir=src/logos
topoutdir=out
topsrcdir=src
include src/logos/Makefile

define nl


endef

# I put this as the last line in the file because it confuses Emacs syntax
# highlighting and makes the remainder of the file difficult to edit.
quote.shell = $(subst $(nl),'$$'\n'','$(subst ','\'',$1)')