aboutsummaryrefslogtreecommitdiff
path: root/common.mk
blob: 0b18c7cc338d2377058f7241dd16ac21c7fdbfc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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'

%.min.js: %.js
	cat $< | $(REMOVE_DOUBLE_SLASH_COMMENTS) | $(TO_SINGLE_LINE) | $(REMOVE_SLASH_STAR_COMMENTS) | $(REMOVE_TABS) | $(REMOVE_WHITESPACE) | $(TRIM_WHITESPACE) > $@

%.min.css: %.css
	cat $< | $(TO_SINGLE_LINE) | $(REMOVE_SLASH_STAR_COMMENTS) | $(REMOVE_TABS) | $(REMOVE_WHITESPACE) | $(TRIM_WHITESPACE) > $@

%: %.m4
	m4 -I.. $< > $@

%.b64: %
	base64 -w0 $< > $@