website: add a 'watch' target
The 'make watch' uses 'entr' to trigger do trigger a 'make build' if
any of the source files changed.
'entr' can be installed on Debian/Ubuntu using 'apt-get install entr'
and 'brew install entr' on OS X.
Change-Id: I926cb9769a9bd74312ba0f5a1b5e0c12bb1a84cc
diff --git a/Makefile b/Makefile
index d10e330..b32a1ca 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@
$(call BROWSERIFY,$<,$@)
################################################################################
-# Build, serve, and deploy
+# Build, serve, watch and deploy
build: $(MDRIP) node_modules public/css/bundle.css public/js/bundle.js gen-scripts
haiku build --helpers helpers.js --build-dir $@
@@ -56,6 +56,13 @@
serve: build
@static build -H '{"Cache-Control": "no-cache, must-revalidate"}'
+# 'entr' can be installed on Debian/Ubuntu using 'apt-get install
+# entr' and 'brew install entr' on OS X.
+.PHONY: watch
+watch: browser/ content/ public/ stylesheets/ templates/
+ @echo "Watching for changes in $^"
+ @find $^ | entr $(MAKE) build
+
TMPDIR := $(shell mktemp -d "/tmp/XXXXXX")
HEAD := $(shell git rev-parse HEAD)