aboutsummaryrefslogtreecommitdiff
path: root/common.mk
diff options
context:
space:
mode:
Diffstat (limited to 'common.mk')
-rw-r--r--common.mk12
1 files changed, 4 insertions, 8 deletions
diff --git a/common.mk b/common.mk
index efbe3c4..9a3a5c3 100644
--- a/common.mk
+++ b/common.mk
@@ -1,17 +1,13 @@
M4FLAGS += -I..
-TO_SINGLE_LINE:=tr '\n' ' '
-REMOVE_DOUBLE_SLASH_COMMENTS:=sed 's/\/\/.*$$//g'
-REMOVE_SLASH_STAR_COMMENTS:=sed 's/\/\*[^\*]*\*\///g'
-REMOVE_TABS:=sed 's/\t//g'
-REMOVE_WHITESPACE:=sed 's/ */ /g'
-TRIM_WHITESPACE:=sed -E 's/^\s*(.*)\s+$$/\1/g'
+JSMIN ?= ../scripts/js2min
+CSSMIN ?= ../scripts/css2min
%.min.js: %.js
- cat $< | $(REMOVE_DOUBLE_SLASH_COMMENTS) | $(TO_SINGLE_LINE) | $(REMOVE_SLASH_STAR_COMMENTS) | $(REMOVE_TABS) | $(REMOVE_WHITESPACE) | $(TRIM_WHITESPACE) > $@
+ $(JSMIN) < $< > $@
%.min.css: %.css
- cat $< | $(TO_SINGLE_LINE) | $(REMOVE_SLASH_STAR_COMMENTS) | $(REMOVE_TABS) | $(REMOVE_WHITESPACE) | $(TRIM_WHITESPACE) > $@
+ $(CSSMIN) < $< > $@
%: %.m4
m4 $(M4FLAGS) $< > $@