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

在Makefile中:

  1. $(obj)include/autoconf.mk: $(obj)include/config.h  
  2.   @$(XECHO) Generating $@ ; /  
  3.   set -e ; /  
  4.   : Extract the config macros ; /  
  5.   $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | /  
  6.     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 > [email protected] && \
	mv [email protected] $@


實際執行的命令:

  1. 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  

 

  1. /^#define CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*/ {  
  2.   # Strip the #define prefix  
  3.   s/#define *//;                
  4.   # Change to form CONFIG_*=VALUE  
  5.   s/  */=/;  
  6.   # Drop trailing spaces        
  7.   s/ *$//;  
  8.   # drop quotes around string values  
  9.   s/="/(.*/)"$/=/1/;            
  10.   # Concatenate string values   
  11.   s/" *"//g;  
  12.   # Wrap non-numeral values with quotes  
  13.   s/=/(.*/?[^0-9].*/)$/=/"/1/"/;   
  14.   # Change '1' and empty values to "y" (not perfect, but  
  15.   # supports conditional compilation in the makefiles  
  16.   s/=$/=y/;  
  17.   s/=1$/=y/;  
  18.   # print the line              
  19.   p                             


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章