5a09db7ad8638a4ef9385a619998509f0de20415 — Christoph Frick 16 days ago 973ed0c
Generate a single version index for the tags
1 files changed, 16 insertions(+), 7 deletions(-)

M makefile
M makefile => makefile +16 -7
@@ 1,10 1,11 @@+.DEFAULT_GOAL := build
+ 
  TAGS := $(shell git --git-dir=./fennel/.git tag -l | grep '^[0-9]' | tac)
+ TAGDIRS := master $(foreach tag, $(TAGS), v${tag})
  
- index.html: main.fnl sample.html ; fennel/fennel main.fnl $(TAGS) > index.html
- fennelview.lua: fennel/fennelview.fnl ; fennel/fennel --compile $^ > $@
- generate.lua: fennel/generate.fnl ; fennel/fennel --compile $^ > $@
+ # which fennel/$.md files build a tag index
+ TAGSOURCES := changelog reference api
  
- .DEFAULT_GOAL := build
  HTML := tutorial.html api.html reference.html lua-primer.html changelog.html
  LUA := generate.lua fennelview.lua
  


@@ 12,16 13,24 @@ PANDOC=pandoc --syntax-definition fennel-syntax.xml \
  	-H head.html -A foot.html -T "Fennel"
  
+ index.html: main.fnl sample.html ; fennel/fennel main.fnl $(TAGDIRS) > index.html
+ fennelview.lua: fennel/fennelview.fnl ; fennel/fennel --compile $^ > $@
+ generate.lua: fennel/generate.fnl ; fennel/fennel --compile $^ > $@
+ 
  %.html: fennel/%.md ; $(PANDOC) -o $@ $^
  
- TAGDIRS := $(foreach tag, $(TAGS), v${tag}) master
+ # TODO: for now all master and tags are generated the same;
+ # there might be time, when we have "generations" of fennel
+ # TODO: dedupe v% and master setup here
  v%/fennel: ; git clone --branch $* fennel $@
+ v%/index.html: $(foreach md, $(TAGSOURCES), v%/fennel/${md}.md); $(PANDOC) -o $@ $^
  master/fennel: ; git clone --branch master fennel $@
+ master/index.html: $(foreach md, $(TAGSOURCES), master/fennel/${md}.md); $(PANDOC) -o $@ $^
+ 
  tagdirs: ; $(foreach tagdir, $(TAGDIRSS), mkdir -p ${tagdir})
  cleantagdirs: ; $(foreach tagdir, $(TAGDIRS), rm -rf ${tagdir})
  tags: tagdirs $(foreach tagdir, $(TAGDIRS), ${tagdir}/fennel)
- 
- TAGDOCS := $(foreach tagdir, $(TAGDIRS), $(addprefix ${tagdir}/, $(HTML)))
+ TAGDOCS := $(foreach tagdir, $(TAGDIRS), $(addprefix ${tagdir}/, index.html))
  
  build: html lua tagdocs
  html: $(HTML) index.html