免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4823 | 回复: 3
打印 上一主题 下一主题

kernel 2.6.31 Makefile求解--自己实在是无解了,求帮助 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-06-22 20:48 |只看该作者 |倒序浏览
# KBUILD_SRC is set on invocation of make in OBJ directory
    90 # KBUILD_SRC is not intended to be used by the regular user (for now)
    91 ifeq ($(KBUILD_SRC),)
    92
    93 # OK, Make called in directory where kernel src resides
    94 # Do we want to locate output files in a separate directory?
    95 ifeq ("$(origin O)", "command line")
    96   KBUILD_OUTPUT := $(O)
    97 endif
    98
    99 # That's our default target when none is given on the command line
   100 PHONY := _all
   101 _all:
   102   
   103 # Cancel implicit rules on top Makefile
   104 $(CURDIR)/Makefile Makefile: ;
   105
   106 ifneq ($(KBUILD_OUTPUT),)
   107 # Invoke a second make in the output directory, passing relevant variables
   108 # check that the output directory actually exists
   109 saved-output := $(KBUILD_OUTPUT)
   110 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
   111 $(if $(KBUILD_OUTPUT),, \
   112      $(error output directory "$(saved-output)" does not exist))
   113
   114 PHONY += $(MAKECMDGOALS) sub-make
   115
   116 $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
   117    $(Q)@:
   118
   119 sub-make: FORCE
   120    $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
   121    KBUILD_SRC=$(CURDIR) \
   122    KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
   123    $(filter-out _all sub-make,$(MAKECMDGOALS))
   124
   125 # Leave processing to above invocation of make
   126 skip-makefile := 1
   127 endif # ifneq ($(KBUILD_OUTPUT),)
   128 endif # ifeq ($(KBUILD_SRC),)
------------------------------------
这段来自顶层makefile的开始部分,101行的_all目标,没有接任何的命令,空行,紧接着是104行的Makefile的依赖,空命令。这是何意思,_all不是默认呢目标?自己在102添了个回显测试,似乎也不是开始就执行?到底为什么?
116行定义了一个依赖关系,这里命令$(Q)@怎么理解?$(Q)开始没有赋值=空,那么简化后等于@:,@开始表示不回显,那么,只剩下:, 那表示什么命令阿?
119行最后表示执行123行计算结果表示的目标,这里为什么又定义了sub_make?
还有就这段而言,到底那个是第一个执行的,我想搞清楚makefile的实际执行过程?
期待经验人士,解答。
我也很想结交能互相帮助的内核开发的人:
backyes@mail.ustc.edu.cn

论坛徽章:
0
2 [报告]
发表于 2010-06-22 22:59 |只看该作者
No idea.

论坛徽章:
0
3 [报告]
发表于 2010-06-23 09:25 |只看该作者
请注意它上面91行的ifeq ($(KBUILD_SRC),)

论坛徽章:
0
4 [报告]
发表于 2010-06-23 15:58 |只看该作者
你再好好找找。

_all就是默认的了。

在下面有
_all: all
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP