最近才明白,Makefile 是一个事物,kbuild 是另外一个事物。
之前一直不知道。
Linux 和 uboot 确实是基于 Makefile 进行编译的,但是单单看 Makefile 的语法,是很难把它两个的编译流程理清楚的。
kbuild 是基于 Makefile 的一套编译框架,用于编译 Linux kernel 和 uboot.
此处省去一万字,后面再补。
笔记$(strip string)
8.2 Functions for String Substitution and Analysis
Removes leading and trailing whitespace from string and replaces each internal sequence of one or more whitespace characters with a single space. Thus, ‘$(strip a b c )’ results in ‘a b c’.
# scripts/Makefile.build/line: 298 $(builtin-target): $(obj-y) FORCE $(call if_changed,link_o_target) # 这是一个普通规则,依赖众多的 obj-y
# scripts/Kbuild.include/line: 171 # printing commands cmd = @$(echo-cmd) $(cmd_$(1)) # 至于 echo-cmd 不是特别重要,暂时先不分析了 # 就是相当于调用了 $(cmd_$(1)) 这个命令
echo @set -e; echo ' -Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" hello/hello.c ;'; -Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" hello/hello.c ; echo ' cc -Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" -c -o hello/hello.o hello/hello.c'; cc -Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" -c -o hello/hello.o hello/hello.c; scripts/basic/fixdep hello/.hello.o.d hello/hello.o 'cc -Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" -c -o hello/hello.o hello/hello.c' > hello/.hello.o.tmp; rm -f hello/.hello.o.d; mv -f hello/.hello.o.tmp hello/.hello.o.cmd
@set -e
-Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" hello/hello.c ;
/bin/sh: 1: -Wp,-MD,hello/.hello.o.d: not found
cc -Wp,-MD,hello/.hello.o.d -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)" -D"KBUILD_MODNAME=KBUILD_STR(hello)" -c -o hello/hello.o hello/hello.c
/bin/sh: 1: scripts/basic/fixdep: not found



