diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-01-19 23:08:03 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-01-19 23:08:03 +0100 |
commit | 9905b8cefdee18f2ed9b503ef27814e9545d8f61 (patch) | |
tree | 775d2d61628d1ce3ea27bf7d262bf7313437714e | |
parent | a0984f9d54d1881592cc7fbd6c5f78e30d51f336 (diff) |
move filters to variables in makefile
-rw-r--r-- | common.mk | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1,8 +1,15 @@ +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 - sed 's/\/\/.*$$//g' $< | tr '\n' ' ' | sed 's/\/\*[^\/]*\*\///g' | sed 's/\t//g' | sed 's/ */ /g' > $@ + cat $< | $(REMOVE_DOUBLE_SLASH_COMMENTS) | $(TO_SINGLE_LINE) | $(REMOVE_SLASH_STAR_COMMENTS) | $(REMOVE_TABS) | $(REMOVE_WHITESPACE) | $(TRIM_WHITESPACE) > $@ %.min.css: %.css - cat $< | tr '\n' ' ' | sed 's/\/\*[^\/]*\*\///g' | sed 's/\t//g' | sed 's/ */ /g' > $@ + cat $< | $(TO_SINGLE_LINE) | $(REMOVE_SLASH_STAR_COMMENTS) | $(REMOVE_TABS) | $(REMOVE_WHITESPACE) | $(TRIM_WHITESPACE) > $@ %.html: %.m4 m4 $< > $@ |