在 Makefile 中记录当前目标
目前我有一个带有多目标规则的 Makefile。它记录目标,然后使用该目标集调用新的 Make。
例如,
$(LIST_OF_PRODUCTS) :
@echo Making $@
@make build_product PRODUCT=$@
输出目录和二进制文件然后使用此产品名称。
如何在不调用新的 Make 实例的情况下记录当前在多目标规则中构建的目标?
我已经尝试过:
$(LIST_OF_PRODUCTS) : PRODUCT := $@
$(LIST_OF_PRODUCTS) : build_product
@echo Making $(PRODUCT) Done.
但这不起作用。
At present I have a Makefile with a multiple target rule. It records the target and then invokes a new Make with that target set.
E.g.
$(LIST_OF_PRODUCTS) :
@echo Making $@
@make build_product PRODUCT=$@
The output directory and binary then use this product name..
How do I record the target currently being built in a multi-target rule without invoking a new Make instance?
I have tried:
$(LIST_OF_PRODUCTS) : PRODUCT := $@
$(LIST_OF_PRODUCTS) : build_product
@echo Making $(PRODUCT) Done.
But this doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出的最好的办法是 GNU make 模板方法:
然而它只是把我的问题推到了其他地方。由于当通过组调用目标时, check_target 仅被调用一次?
例如
The best I came up with is the GNU make template method:
However its just pushed my problem elsewhere. Since check_target is only called once when that targets are called via a group?
E..g