在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 > $@
在2011-12中:
#
# Auto-generate the autoconf.mk file (which is included by all makefiles)
#
# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
# the dep file is only include in this top level makefile to determine when
# to regenerate the autoconf.mk file.
$(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 $(CFLAGS) $(CPPFLAGS) \
-MQ $(obj)include/autoconf.mk include/common.h > $@
$(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 > $@.tmp && \
mv $@.tmp $@
实际执行的命令:
- 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
- }