make 默认_如何更改`make`的默认目标?

make 默认

The default target of make is the first target. But can I change the default target in Makefile and how to change the default target of make?

make默认目标是第一个目标。 但是我可以在Makefile中更改默认目标吗?如何更改make的默认目标?

The default goal of make is the first target whose name does not start with ‘.’ if .DEFAULT_GOAL is not set. Ref: make manual.

make的默认目标是名称不以“。” 开头的第一个目标。 如果未设置.DEFAULT_GOAL 。 参考: 制作手册

To set the default target to ‘default’ as an example being not the first target in the Makefile, you have at least 2 ways.

要将默认目标设置为“默认”而不是Makefile中的第一个目标的示例,您至少有两种方法。

Way 1. Set the .DEFAULT_GOAL special variable to ‘default’.

方法1.将.DEFAULT_GOAL特殊变量设置为“默认”。

.DEFAULT_GOAL := default

# other targets ...

default:
    @ echo default target

Way 2. clear the .DEFAULT_GOAL special variable before the ‘default’ target so that ‘default’ turns to the first target after .DEFAULT_GOAL is not set.

方法2.清除“默认”目标之前的.DEFAULT_GOAL特殊变量,以便在未设置.DEFAULT_GOAL之后将“默认”转换为第一个目标。

# other targets ...

.DEFAULT_GOAL :=
# no target starting with '.' should be here
# between .DEFAULT_GOAL and 'default'
default:
    @ echo default target
Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/how-to-change-the-default-target-of-make/

make 默认

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值