summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-04 17:13:22 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-04 17:13:22 -0500
commit90e593e800e62b1605a8052a54e0ab3371dd3dde (patch)
tree35290948b249e6e756a3fdf6724fc8aa2bb4c6af /Makefile
parent5e257d407b4abf2be61c656dfb1d383396df35b1 (diff)
implement sections
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 16 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index dc232dd..28677ff 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,10 @@ html.suffixes = md org
html.src = $(shell find src -type f \( -false $(foreach s,$(html.suffixes), -o -name '*.$s' ) \))
# Translate the source filenames into output filenames
html.out = $(call patsubst-all,$(addprefix src/%.,$(html.suffixes)),out/%.html,$(html.src))
-html.out += $(foreach d,$(sort $(dir $(patsubst src/%,out/%,$(html.src)))),$dindex.html $dindex.atom)
+html.dirs = $(sort $(patsubst src%,out%, \
+ $(patsubst %/,%,$(dir $(html.src))) \
+ $(shell find src -name index.yaml -printf '%h\n')))
+html.out += out/index.atom $(addsuffix /index.html,$(html.dirs))
all: $(html.out) out/main.css
.PHONY: all
@@ -45,10 +48,18 @@ index.all = $(filter-out %/ChangeLog.md %/index.md,$(html.src) $(shell find src
index.filter = $(filter-out %/index.yaml,$(filter $(@D)/% $(patsubst out%,src%,$(@D))/%,$1))
index.cmd = bin/index $(patsubst .%,%,$(suffix $@)) $(@D) $(call index.filter,$^) | bin/write-atomic $@
index.dep = $(bin/index) bin/index.$1.erb .var.index.all $(index.all) bin/write-atomic Makefile
-out/index.md : $(call index.dep,md) ; $(index.cmd)
-out/%/index.md : $(call index.dep,md) ; $(index.cmd)
-out/index.atom : $(call index.dep,atom) ; $(index.cmd)
-out/%/index.atom : $(call index.dep,atom) ; $(index.cmd)
+out/index.md : $(call index.dep,md)
+ @mkdir -p $(@D)
+ $(index.cmd)
+out/%/index.md : $(call index.dep,md)
+ @mkdir -p $(@D)
+ $(index.cmd)
+out/index.atom : $(call index.dep,atom)
+ @mkdir -p $(@D)
+ $(index.cmd)
+out/%/index.atom : $(call index.dep,atom)
+ @mkdir -p $(@D)
+ $(index.cmd)
serve: serve-8000
serve-%: all