u-boot $(obj)include/autoconf.mk.dep

一、uboot编译起始部分打印

Generating include/autoconf.mk
Generating include/autoconf.mk.dep
for dir in tools examples/standalone examples/api cpu/arm920t /home/fly1000fans/source/u-boot-2010.03/cpu/arm920t/ ; do \
		make -C $dir _depend ; done
make[1]: Entering directory '/home/fly1000fans/source/u-boot-2010.03/tools'
make[1]: Nothing to be done for '_depend'.
make[1]: Leaving directory '/home/fly1000fans/source/u-boot-2010.03/tools'
make[1]: Entering directory '/home/fly1000fans/source/u-boot-2010.03/examples/standalone'
make[1]: Nothing to be done for '_depend'.
make[1]: Leaving directory '/home/fly1000fans/source/u-boot-2010.03/examples/standalone'
make[1]: Entering directory '/home/fly1000fans/source/u-boot-2010.03/examples/api'
make[1]: Nothing to be done for '_depend'.
make[1]: Leaving directory '/home/fly1000fans/source/u-boot-2010.03/examples/api'
make[1]: Entering directory '/home/fly1000fans/source/u-boot-2010.03/cpu/arm920t'
make[1]: Nothing to be done for '_depend'.
make[1]: Leaving directory '/home/fly1000fans/source/u-boot-2010.03/cpu/arm920t'
make[1]: Entering directory '/home/fly1000fans/source/u-boot-2010.03/cpu/arm920t'
make[1]: Nothing to be done for '_depend'.
make[1]: Leaving directory '/home/fly1000fans/source/u-boot-2010.03/cpu/arm920t'
make -C tools all

 可以看到一开始创建了autoconf.mk,autoconf.mk.dep两个文件。

二、uboot顶层Makefile中 autoconf.mk.dep依赖规则

$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
	@$(XECHO) Generating $@ ; \
	set -e ; \
	: Generate the dependancies ; \
	$(CC) -x c -DDO_DEPS_ONLY -M $(HOSTCFLAGS) $(CPPFLAGS) \
		-MQ $(obj)include/autoconf.mk include/common.h > $@

分析:

1、$(obj),在不指定编译目录的情况下,目标文件都生成在源文件所在路径,$(obj)的值为空

2、include/autoconf.mk.dep依赖 include/config.h include/common.h,其中include/config.h为动态创建,include/common.h原来就有

3、$(XECHO)在非安静编译的情况下为echo

4、set -e,后面的指令如果执行失败则退出,不继续执行接下来的指令

5、$(CC)为交叉编译设置的arm-linux-gcc

6、-M 生成目标依赖关系,其中目标的格式为源文件去路径文件名+.o后缀

7、-MQ相当于-MT,覆盖默认的源文件去路径文件名+.o后缀的目标生成格式,采用指定的字符串

8、$@为自动变量,代表依赖关系中的目标

9、-x c,指定源文件使用C语言语法

总体来说:该依赖关系用来生成include/autoconf.mk.dep,生成的方法是生成 include/common.h的依赖关系

你可能感兴趣的:(uboot)