From 90e593e800e62b1605a8052a54e0ab3371dd3dde Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 4 Jan 2017 17:13:22 -0500 Subject: implement sections --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3