u-boot中的include/autoconf.mk文件是如何生成的

Makefile配置生成
本文介绍了一个使用Makefile从config.h生成autoconf.mk的过程。通过GCC预处理器和sed命令,该过程实现了宏定义的提取和转换,以便在后续的构建过程中使用。

在Makefile中:

$(obj)include/autoconf.mk: $(obj)include/config.h @$(XECHO) Generating $@ ; / set -e ; / : Extract the config macros ; / $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | / sed -n -f tools/scripts/define2mk.sed > $@

实际执行的命令:

arm-none-linux-gnueabi-gcc -E -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0xc3e00000 -I/home/zkl/svn/compiled/uboot-1.3.4-m9_v4/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv5te -mabi=apcs-gnu -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -DDO_DEPS_ONLY -dM include/common.h | sed -n -f tools/scripts/define2mk.sed

/^#define CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*/ { # Strip the #define prefix s/#define *//; # Change to form CONFIG_*=VALUE s/ */=/; # Drop trailing spaces s/ *$//; # drop quotes around string values s/="/(.*/)"$/=/1/; # Concatenate string values s/" *"//g; # Wrap non-numeral values with quotes s/=/(.*/?[^0-9].*/)$/=/"/1/"/; # Change '1' and empty values to "y" (not perfect, but # supports conditional compilation in the makefiles s/=$/=y/; s/=1$/=y/; # print the line p }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值