您应该如何在随附的Makefile中使用.PHONY?

问题描述 投票:0回答:1

说我有一组Makefile模块:

# foo.mk

rule1: prereq1
    recipe1

# bar.mk

rule2: prereq2
    recipe2

和主Makefile:

# Makefile

include foo.mk
include bar.mk

应该在每个单独的.mk文件中仅将假目标作为.PHONY:包含在该文件中,还是应该仅在主Makefile中包含一些累积的列表?

# foo.mk
TARGETS += rule1
...
# bar.mk
TARGETS += rule2
...
# Makefile
.PHONY: $(TARGETS)

我在GNU Make docs或类似问题中没有发现任何相关内容。

makefile gnu-make
1个回答
0
投票

声明

© www.soinside.com 2019 - 2024. All rights reserved.