summaryrefslogtreecommitdiff
path: root/Makefile
blob: 73b4ea9499f21ff94fbe13c56779daea3d94ce81 (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. sassc --load-path /usr/share/sass/stylesheets $(compass_plugins:%=--load-path /usr/share/compass/frameworks/%/stylesheets) --style compressed $< $@
  24. clean:
  25. rm -f $(vectorimage-graph)
  26. find -type f -name '*.html' -delete
  27. find -type d -empty -delete
  28. rm -f style.css style.css.map
  29. rm -rf .sass-cache
  30. MAKEFLAGS += --jobs
  31. .NOTPARALLEL: source
  32. .PHONY: all update clean