包括makefile,它的作用是什么(搜索路径)(无扩展)。。。什么意思?

包括makefile,它的作用是什么(搜索路径)(无扩展)。。。什么意思?,makefile,gnu-make,Makefile,Gnu Make,今天,当我用--debug=v构建我的项目时,我注意到一些我并不真正理解的东西 在他包含“子生成文件”的顶部,有一个奇怪的打印输出,告诉我(搜索路径)(无扩展)。。。这是什么意思 打印输出如下所示: Reading makefiles... Reading makefile `Makefile'... Reading makefile `make_pc.mk' (search path) (no ~ expansion)... Reading makefile `print_ring/make.

今天,当我用--debug=v构建我的项目时,我注意到一些我并不真正理解的东西

在他包含“子生成文件”的顶部,有一个奇怪的打印输出,告诉我(搜索路径)(无扩展)。。。这是什么意思

打印输出如下所示:

Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `make_pc.mk' (search path) (no ~ expansion)...
Reading makefile `print_ring/make.mk' (search path) (no ~ expansion)...
Reading makefile `vendor/unity/make.mk' (search path) (no ~ expansion)...
Reading makefile `test01/make.mk' (search path) (no ~ expansion)...
TEST := test01
include $(TEST)/make.mk
CFLAGS  += -Itest01/
OBJ += test_main.o
test_main.o: test01/test_main.c
    @ echo ".compiling"
    $(CC) $(CFLAGS) -o $@ $<
主Makefile中使用include的行如下所示:

Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `make_pc.mk' (search path) (no ~ expansion)...
Reading makefile `print_ring/make.mk' (search path) (no ~ expansion)...
Reading makefile `vendor/unity/make.mk' (search path) (no ~ expansion)...
Reading makefile `test01/make.mk' (search path) (no ~ expansion)...
TEST := test01
include $(TEST)/make.mk
CFLAGS  += -Itest01/
OBJ += test_main.o
test_main.o: test01/test_main.c
    @ echo ".compiling"
    $(CC) $(CFLAGS) -o $@ $<
包含的makefile可能如下所示:

Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `make_pc.mk' (search path) (no ~ expansion)...
Reading makefile `print_ring/make.mk' (search path) (no ~ expansion)...
Reading makefile `vendor/unity/make.mk' (search path) (no ~ expansion)...
Reading makefile `test01/make.mk' (search path) (no ~ expansion)...
TEST := test01
include $(TEST)/make.mk
CFLAGS  += -Itest01/
OBJ += test_main.o
test_main.o: test01/test_main.c
    @ echo ".compiling"
    $(CC) $(CFLAGS) -o $@ $<
CFLAGS+=-Itest01/
OBJ+=测试_main.o
test_main.o:test01/test_main.c
@“编译”
$(CC)$(CFLAGS)-o$@$<
有没有更好的方法来使用搜索路径?但是~会扩展到我的unix用户home dir吗

注意:我是在Linux(Ubuntu)机器上做这件事的

注意:所有文件都可以在此处找到


/谢谢

这些信息中的一些是针对调试Make本身的人,而不是针对调试自己项目的构建基础结构的人,因此,如果没有真正的文档记录,或者没有专门用于跟踪您自己的构建问题,也就不足为奇了

这就是说,您可以通过花几分钟的时间使用GNU Make源代码来理解这意味着什么

(搜索路径)是Make的内部
RM_INCLUDED
标志,它(我正在总结)意味着该makefile是通过另一个makefile中的
include
遇到的,可能已经检查了
-I
搜索路径以找到它

(无扩展)是其内部的
RM_no_TILDE
标志,并在Make's read.c中的注释中解释:

GNU Make确实做到了,这个标志阻止它发生两次——我想这可能会对一些非常不寻常的文件系统布局产生影响