GNU make - 只依赖于文件存在而不是修改时间

GNU make - depend only on file existence and not modification time

我想要一个 makefile,其中我有一个任务 a 只能 运行 如果文件 b 存在,但不需要重新 运行 如果b 已更新。我该怎么做?

你想要一个 order-only prerequisite:

Occasionally, however, you have a situation where you want to impose a specific ordering on the rules to be invoked without forcing the target to be updated if one of those rules is executed. In that case, you want to define order-only prerequisites.

请注意,并非所有版本的 make 都支持此功能。