summaryrefslogtreecommitdiff
path: root/Makefile
blob: cf14472ea7326de3bc393bb23ddd176b19b6c6a6 (plain)
  1. markdown-snippets := topbar.mdwn footer.mdwn
  2. hypertext-snippets = $(markdown-snippets:%.mdwn=%.html)
  3. markdown := $(filter-out $(markdown-snippets),$(wildcard *.mdwn */*.mdwn */*/*.mdwn))
  4. hypertext = $(subst index/index,index,$(markdown:%.mdwn=%/index.html))
  5. graph := $(wildcard *.dot */*.dot */*/*.dot)
  6. vectorimage-graph := $(graph:%.dot=%.svg)
  7. sitetitle := $(shell head --lines=1 index.mdwn | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+')
  8. compass_plugins = h5bp
  9. all: $(hypertext) $(vectorimage-graph) style.css
  10. update: .git
  11. git pull
  12. $(MAKE) all
  13. $(hypertext-snippets): %.html: %.mdwn Makefile
  14. pandoc -f commonmark -t html -o $@ $<
  15. sed -i -e '1i <div class=\"$*\">' -e '$$ a </div>' $@
  16. $(vectorimage-graph): %.svg: %.dot Makefile
  17. dot -Tsvg -o$@ $<
  18. %.html %/index.html: %.mdwn $(hypertext-snippets) Makefile
  19. $(eval title = $(shell head --lines=1 $< | grep --perl-regexp --only-matching '^\#\s*\K(\S+(\s\S+)*)+'))
  20. $(if $(filter-out ./,$(dir $@)),mkdir -p $(dir $@))
  21. pandoc -s $(if $(title),--metadata pagetitle='$(if $(filter-out $(sitetitle),$(title)),$(sitetitle) -- )$(title)') -c $(shell realpath --relative-to=$(dir $@) style.css) -B topbar.html -A footer.html -f commonmark -t html -o $@ $<
  22. %.css : %.scss Makefile
  23. # scss --compass --style compressed $< $@
  24. sassc --load-path /usr/share/sass/stylesheets $(compass_plugins:%=--load-path /usr/share/compass/frameworks/%/stylesheets) --style compressed $< $@
  25. clean:
  26. rm -f $(vectorimage-graph)
  27. find -type f -name '*.html' -delete
  28. find -type d -empty -delete
  29. rm -f style.css style.css.map
  30. rm -rf .sass-cache
  31. MAKEFLAGS += --jobs
  32. .NOTPARALLEL: source
  33. .PHONY: all update clean