为什么这个makefile不生效
我想使用 Google Closure Compiler 来编译我的 js 代码。我编写了一个 makefile 来完成这项工作,但它从未生效。 我想要的是编译 filelist 中列出的每个文件并将其输出到 ../js/
filelist = thermometer.js logic.combat.js analyse.js logic.js
wp := $(foreach k, $(filelist), ../js/$(k))
$(wp) : $(filelist)
java -jar compiler.jar --js=$< --js_output_file=../js/$<
I wanna use Google Closure Compiler to compile my js codes.I write a makefile to do the job but it never takes effect.
What I want is to compile each file listed in filelist and output it to ../js/
filelist = thermometer.js logic.combat.js analyse.js logic.js
wp := $(foreach k, $(filelist), ../js/$(k))
$(wp) : $(filelist)
java -jar compiler.jar --js=lt; --js_output_file=../js/lt;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在当前的公式中,所有 wp 对象都依赖于所有 js 文件,并且仅编译第一个源文件(thermometer.js)。
您应该使用模式规则来制定 Makefile 中的最后两行:
In the current formulation, all of the wp objects depend on all js files, and only the first source file is ever compiled (thermometer.js).
You should rather formulate the last two lines in the Makefile with pattern rules:
首先,您可能需要一些目标来触发它,例如:
其次,您将获得一个命令 java -jar compiler.jar --js=../js/thermometer.js --js_output_file=.. /js/../js/thermometer.js 对于每个文件。这不太可能是您的目标。我想你想要这样的东西:
First, you probably need some target to trigger it, like:
Second, you're going to get a command
java -jar compiler.jar --js=../js/thermometer.js --js_output_file=../js/../js/thermometer.js
for every single file. Which is not likely to be your goal. I think you want something like that: