blob: 37b617c06da451ff3dceb9baf8c7b6faac6bcbed (
plain) (
blame)
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
|
.PHONY: check clean serve watch
MAKEFLAGS := -j$(shell nproc)
# Source- and destination files
srcs := $(shell find src -type f -not -name '*.gsp' -or -name 'index.gsp')
dsts := $(srcs:src/%=out/%)
dsts := $(dsts:%.gsp=%.html)
dsts := $(dsts:%.dot=%.svg)
# Destination directories
dirs := $(sort $(dir $(dsts)))
# Files that most *.gsp files will depend on
incs := $(wildcard include/*)
all: $(dirs) $(dsts)
$(dirs)&:
@mkdir -p $(dirs)
@printf 'MKDIR\t%s\n' $(dirs)
out/%: src/%
@cp $< $@
@printf 'CP\t%s\n' $@
out/%.svg: src/%.dot
@dot -Tsvg $< >$@
@printf 'DOT\t%s\n' $@
# Generate dependencies for GSP pages
gendeps = $(incs) $(wildcard $(dir $(patsubst out/%.html,src/%.gsp,$1))*.gsp)
.SECONDEXPANSION:
out/%.html: src/%.gsp $$(call gendeps,$$@)
@PATH="$$PATH:./include" \
m4 -P $(foreach dir,$(^D),-I$(dir)) include/lib.m4 $< | gsp >$@
@printf 'GSP\t%s\n' "$@"
check:
LANG=en_US.UTF-8 find src -name 'index.gsp' -exec \
aspell --home-dir=./ --ignore-case check {} \;
clean:
rm -rf out
serve:
darkhttpd out --daemon
watch:
git ls-files -o | entr $(MAKE)
|