如何获得makefile的调用目标? [英] How to get the invoking target of makefile?

查看:87
本文介绍了如何获得makefile的调用目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取GNU make Makefile的调用目标?

How to get the invoking target of the GNU make Makefile?

例如,我使用以下命令行调用make:

for example, I invoke make with the following command line:

make a-target

如何在Makefile中获取调用目标"a-target"并将其分配给变量?

How can I get the invoking target "a-target" in the Makefile and assign it to a variable?

如果在命令行上指定了多个目标,则进一步:

Further more, if more than one target is specified on the command line:

make target1 target2 ...

我如何得到所有这些?

推荐答案

变量

The variable MAKECMDGOALS contains the list of targets that were specified on the command line, no matter how many (it's empty if there were none).

这篇关于如何获得makefile的调用目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆