加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Makefile规则定义中的分号

发布时间:2020-12-16 06:44:13 所属栏目:百科 来源:网络整理
导读:我在Makefile中看到如下几个规则: $(PATH)/foo.inc:;include $(PATH)/foo.inc$(PATH)/bar.inc:;include $(PATH)/bar.inc 规则定义末尾的分号是无操作的还是具有特定含义? 解决方法 与目标先决条件一致的分号是执行此规则的第一个命令行,至少在GNU make中.
我在Makefile中看到如下几个规则:
$(PATH)/foo.inc:;
include $(PATH)/foo.inc

$(PATH)/bar.inc:;
include $(PATH)/bar.inc

规则定义末尾的分号是无操作的还是具有特定含义?

解决方法

与目标先决条件一致的分号是执行此规则的第一个命令行,至少在GNU make中.

从本手册的第5章:

The commands of a rule consist of shell command lines to be executed
one by one. Each command line must start with a tab,except that the
first command line may be attached to the target-and-prerequisites
line with a semicolon in between.

在你的情况下,因为在分号之后没有命令,所以它最终是一个无操作的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读