Makefile 规则以相同名称但不同目录构建
我想要一个类似的规则:
build/%.ext: src/%.ext
action
我想要优化的文件夹中有一个文件目录,然后输出到另一个文件夹。 但是,输入和输出文件夹中的文件具有相同的名称。 我已经尝试了上述规则的各种迭代,但是 make 要么总是重建,要么从不重建,具体取决于我如何调整上述规则。 建议?
编辑: 我最终得到了以下解决方案,效果很好!
JS = \
src/js/script2.js \
src/js/script1.js
JS_OPT = $(patsubst src/js/%.js,web/js/%.js, $(JS))
all: $(JS_OPT)
$(JS_OPT): web/js/%.js: src/js/%.js
cat $@ | ./bin/jsmin > $<
I would like a rule something like:
build/%.ext: src/%.ext
action
I have one directory of files in a folder that I want to optimize and then output to a different folder. However, the files have the same name in the input and output folders. I have tried various iterations of the rule above, but make will either always or never rebuild depending how I tweak the above. Suggestions?
EDIT:
I ended up with the following solution, which works great!
JS = \
src/js/script2.js \
src/js/script1.js
JS_OPT = $(patsubst src/js/%.js,web/js/%.js, $(JS))
all: $(JS_OPT)
$(JS_OPT): web/js/%.js: src/js/%.js
cat $@ | ./bin/jsmin > lt;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这样的想法:
Try somethink like this: