diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -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 |