这是我的Makefile,我正在尝试使用Make来连接/缩小我的JS脚本:
all: myproject.js
JS_TARGETS = file1.js file2.js
JS_MINIFIED = $(JS_TARGETS:.js=.min.js)
# I use addprefix because my files are in a js/ directory
myproject.js: $(addprefix js/, $(JS_MINIFIED)) $(addprefix js/, $(JS_TARGETS))
cat $^ >$@
# Minification + new line
%.min.js: %.js
uglifyjs -o $< $@
echo >> $<
clean:
rm -f myproject.js
.PHONY: clean
答案 0 :(得分:1)
对不起,这是一个$@
/ $<
混乱,它现在有效:
# Minification + new line
%.min.js: %.js
uglifyjs -o $@ $<
echo >> $@