- 论坛徽章:
- 0
|
# 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 |
|