summaryrefslogtreecommitdiffstats
path: root/web/templates/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'web/templates/Makefile')
-rw-r--r--web/templates/Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/web/templates/Makefile b/web/templates/Makefile
new file mode 100644
index 0000000..339a911
--- /dev/null
+++ b/web/templates/Makefile
@@ -0,0 +1,24 @@
+DIRS=$(wildcard *.d)
+FILEEXT=
+SRCTARGETS=$(patsubst %.d,dist/%.src.js,$(DIRS))
+MINTARGETS=$(patsubst %.d,dist/%.min.js,$(DIRS))
+
+depend=$(shell sh -c 'ls $$(echo $1 | cut -d/ -f2 | cut -d. -f1).d/*$(FILEEXT)')
+
+.PHONY: all mkdist
+all: $(MINTARGETS)
+clean:
+ rm -f $(SRCTARGETS)
+ rm -f $(MINTARGETS)
+mkdist:
+ @@mkdir -p dist
+
+.SECONDEXPANSION:
+$(SRCTARGETS): $$(call depend,$$@) | mkdist
+ date
+ handlebars --output $@ $^
+
+.SECONDEXPANSION:
+$(MINTARGETS): $$(patsubst %.min.js,%.src.js,$$@)
+ date
+ uglifyjs $^ > $@