summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2020-02-27 19:03:05 +0100
committerJonas Smedegaard <dr@jones.dk>2020-02-27 19:03:05 +0100
commitc3f5f58fa7351c95613a8052ad579c22df33bb54 (patch)
tree88ad85c3e47661bc3497470d9705df94fd69288f /Makefile
initial layout
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..63ceea8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+markdown-snippets := topbar.mdwn footer.mdwn
+hypertext-snippets = $(markdown-snippets:%.mdwn=%.html)
+markdown := $(filter-out $(markdown-snippets),$(wildcard *.mdwn */*.mdwn */*/*.mdwn))
+hypertext = $(subst index/index,index,$(markdown:%.mdwn=%/index.html))
+graph := $(wildcard *.dot */*.dot */*/*.dot)
+vectorimage-graph := $(graph:%.dot=%.svg)
+
+compass_plugins = h5bp
+
+all: $(hypertext) $(vectorimage-graph) style.css
+
+update: .git
+ git pull
+ $(MAKE) all
+
+$(hypertext-snippets): %.html: %.mdwn Makefile
+ pandoc -f commonmark -t html -o $@ $<
+ sed -i -e '1i <div class=\"$*\">' -e '$$ a </div>' $@
+
+$(vectorimage-graph): %.svg: %.dot Makefile
+ dot -Tsvg -o$@ $<
+
+%.html %/index.html: %.mdwn $(hypertext-snippets) Makefile
+ $(if $(filter-out ./,$(dir $@)),mkdir -p $(dir $@))
+ pandoc -s -c $(shell realpath --relative-to=$(dir $@) style.css) -B topbar.html -A footer.html -f commonmark -t html -o $@ $<
+
+%.css : %.scss Makefile
+# scss --compass --style compressed $< $@
+ sassc --load-path /usr/share/sass/stylesheets $(compass_plugins:%=--load-path /usr/share/compass/frameworks/%/stylesheets) --style compressed $< $@
+
+clean:
+ rm -f $(vectorimage-graph)
+ find -type f -name '*.html' -delete
+ find -type d -empty -delete
+ rm -f style.css style.css.map
+ rm -rf .sass-cache
+
+MAKEFLAGS += --jobs
+.NOTPARALLEL: source
+.PHONY: all update clean