summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-12-31 22:48:59 -0700
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-12-31 22:48:59 -0700
commitb864379651d4bfe3d05f98350b720794ffa2806a (patch)
treec4bc81a8371694d661b10118b4932480aaa37d0b /Makefile
parent7445ea9d56071cfca247689e22c6fded65c3f968 (diff)
more
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile40
1 files changed, 35 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 54f6d26..6c58b95 100644
--- a/Makefile
+++ b/Makefile
@@ -14,26 +14,56 @@ html.suffixes = md org
# Find all source files with those suffixes
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 = $(call patsubst-all,$(addprefix src/%.,$(html.suffixes)),out/%.html,$(html.src))
+html.out += $(addsuffix index.html,$(sort $(dir $(patsubst src/%,out/%,$(html.src)))))
+
+mydir = $(patsubst %/,%,$(patsubst out/%,%,$(dir $@)))
all: $(html.out) out/main.css out/DND/DND.css
+.PHONY: all
bin/page = bin/page bin/util.rb bin/pandoc.rb
+bin/index = bin/index bin/util.rb bin/pandoc.rb
out/%.html: src/%.md $(bin/page) bin/page.html.erb bin/write-atomic
mkdir -p $(@D)
bin/page html $< | bin/write-atomic $@
+out/%.html: out/%.md $(bin/page) bin/page.html.erb bin/write-atomic
+ bin/page html $< | bin/write-atomic $@
+
out/%.html: src/%.org $(bin/page) bin/page.html.erb bin/write-atomic
mkdir -p $(@D)
bin/page html $< | bin/write-atomic $@
+out/%.html: out/%.org $(bin/page) bin/page.html.erb bin/write-atomic
+ bin/page html $< | bin/write-atomic $@
+
out/%.css: src/%.scss
mkdir -p $(@D)
scss --stdin < $< > $@
+out/%.css: out/%.scss
+ scss --stdin < $< > $@
-#out/index.md : index index.md.erb .var.articles $(addsuffix .md,$(articles)) util.rb Makefile write-atomic
-# ./index md $(filter %.md,$^) | ./write-atomic $@
-#out/index.atom: index index.atom.erb .var.articles $(addsuffix .md,$(articles)) util.rb Makefile write-atomic
-# ./index atom $(filter %.md,$^) | ./write-atomic $@
+out/%/index.md : $(bin/index) bin/index.md.erb .var.html.src $(html.src) bin/write-atomic
+ bin/index md $(mydir) $(filter $(patsubst out/%,src/%,$(@D))/%,$^) | bin/write-atomic $@
+out/%/index.atom: $(bin/index) bin/index.atom.erb .var.html.src $(html.src) bin/write-atomic
+ bin/index atom $(mydir) $(filter $(patsubst out/%,src/%,$(@D))/%,$^) | bin/write-atomic $@
+www:
+ mkdir -p $@
+ unionfs -o ro out:src www
+
+.var.%: FORCE bin/write-ifchanged
+ @printf '%s' $(call quote.shell,$($*)) | sed 's/^/#/' | bin/write-ifchanged $@
+-include $(wildcard .var.*)
+
+.PHONY: FORCE
.DELETE_ON_ERROR:
.SECONDARY:
+
+define nl
+
+
+endef
+# I put this as the last line in the file because it confuses Emacs syntax
+# highlighting and makes the remainder of the file difficult to edit.
+quote.shell = $(subst $(nl),'$$'\n'','$(subst ','\'',$1)')