include makefile,(搜索路径)(无〜扩展)...是什么意思?
今天,当我使用 --debug=v 构建项目时,我注意到一些我不太明白它的含义的东西。
在他包含“子 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)...
主 Makefile 中使用 include 的行如下所示:
TEST := test01
include $(TEST)/make.mk
包含的 makefile 可能如下所示:
CFLAGS += -Itest01/
OBJ += test_main.o
test_main.o: test01/test_main.c
@ echo ".compiling"
$(CC) $(CFLAGS) -o $@ $<
有更好的方法来使用搜索路径吗?但是〜会扩展到我的unix用户主目录吗?
注意:我是在 Linux (Ubuntu) 计算机上执行此操作。
注意:所有文件都可以在这个github项目中找到。
/谢谢
Today when I built my project with the --debug=v I noticed something that I don't really understand what it means.
Right at the top where he includes the "sub makefiles" there is a strange printout that tells me (search path) (no ~ expansion)... What does this mean?
The printout looks like this:
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)...
The line in the main Makefile that is using include looks like this:
TEST := test01
include $(TEST)/make.mk
And a included makefile could look like this:
CFLAGS += -Itest01/
OBJ += test_main.o
test_main.o: test01/test_main.c
@ echo ".compiling"
$(CC) $(CFLAGS) -o $@ lt;
Is there a better way to play with the search paths? But would ~ expand to my unix user home dir?
Note: I am doing this on a Linux (Ubuntu) machine.
Note: All the files can be found at in this github project.
/Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其中一些信息是针对人们调试 Make 本身,而不是调试他们自己项目的构建基础设施,因此,如果它没有真正记录或对于跟踪您自己的构建问题特别有用,也不会太令人惊讶。
也就是说,您可以花几分钟查看 GNU Make 源代码来弄清楚这些含义。
(搜索路径) 是 Make 的内部
RM_INCLUDED
标志,这(我过度概括了)意味着这个 makefile 是通过另一个 makefile 中的include
遇到的,并且-I
搜索路径可能已被检查以找到它。(无 ~ 扩展) 是其内部
RM_NO_TILDE
标志,并在 Make 的 read.c 中的注释中进行了解释:GNU Make 确实将 ~ 扩展到主目录,这个标志可以阻止它发生两次 -我想这可以使一些非常不寻常的文件系统布局的差异。
Some of this information is aimed at people debugging Make itself rather than debugging the build infrastructure of their own projects, so it's not too surprising if it's not really documented or of particular use for tracking down your own build problems.
That said, you can figure out what these mean by spending a few minutes with the GNU Make source code.
(search path) is Make's internal
RM_INCLUDED
flag, which (I'm oversummarizing) means this makefile was encountered viainclude
within another makefile and the-I
search path may have been examined to find it.(no ~ expansion) is its internal
RM_NO_TILDE
flag and is explained in this comment in Make's read.c:GNU Make does indeed expand ~ to home directories, and this flag stops it from happening twice -- which I suppose could make a difference on some very unusual file system layouts.