Makefile规则定义中的分号

前端之家收集整理的这篇文章主要介绍了Makefile规则定义中的分号前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在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.

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

原文链接:https://www.f2er.com/c/113244.html

猜你在找的C&C++相关文章