makefile - 为什么注释会使我的 Makefile 命令无效?
问题描述
我正在尝试向我的 Makefile 添加一些评论,但看到一些我不理解的奇怪行为。以下以 a 成功make plan-all
:
plan-all: \
plan-master \
plan-log-archive \
plan-shared \
plan-audit \
但是,如果我尝试添加评论:
plan-all: \
# --------------------
# Global Accounts |
# --------------------
plan-master \
plan-log-archive \
plan-shared \
plan-audit \
我失败了:
make: plan-master: 没有这样的文件或目录
解决方案
无法将注释添加到使用反斜杠的逻辑行中。这是不可能的。
您可以在规则之前添加它们,也可以使用多个规则而不是反斜杠:
# --------------------
# Global Accounts |
# --------------------
plan-all: \
plan-master \
plan-log-archive \
plan-shared \
plan-audit \
或者
# --------------------
# Global Accounts |
# --------------------
plan-all: \
plan-master
# -------------------
# Other Accounts |
# -------------------
plan-all: \
plan-log-archive \
plan-shared \
plan-audit \
推荐阅读
- sql - 如何在 oracle apex 中正确地将图像链接设置为动态列表?
- javascript - NFC NFD 在 Photoshop Javascript 中标准化?
- javascript - Vscode Path Intellisense 不适用于 jsconfig.json(下一个 js)
- tsql - Lat 和 Long 排序 Cast decimal
- php - 如何从目录/子目录中正确访问类?
- c# - 在 .Net 中支持不同版本的 TLS
- arabic - 在 RTF 模板中以阿拉伯语显示文本
- rx-swift - 一旦网络在 RxSwift 中断开,再次触发 api
- python - Pandas Dataframe 根据具有相等值的两列删除行
- azure - 为什么 Azure 虚拟网络快速路由网关需要公共 IP?