uboot-顶层Makefile注释

这是初看,UBOOT的顶层Makefile后的结果,当然参考了网上不少前辈的文章,虽然看懂了不少,可是对于Makefile真的是有点学无止境的感觉,好多地方还看得含含糊糊的呵,要加油!!
rarmkconfig
rar顶层makefile
rar参考的文章。写的很好
#u-boot-2009-01
# (C) Copyright 2000-2008
# Wolfgang Denk, DENX Software Engineering, [email protected].
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundatio; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#常量定义
VERSION = 2009
PATCHLEVEL = 01
SUBLEVEL =
EXTRAVERSION =
ifneq "$(SUBLEVEL)" ""
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
else
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
endif
TIMESTAMP_FILE = $(obj)include/timestamp_autogenerated.h
VERSION_FILE = $(obj)include/version_autogenerated.h
 
HOSTARCH := $(shell uname -m | /                 
#$(shell xxx)的意思是在shell中执行xxx命令
 sed -e s/i.86/i386/ /                                
#sed -e的意思,就是表示后面跟的是一串命令脚本,s/abc/def/的命令表达式,就是表示要从标准输入中,查找到内容为abc的,然后替换成def
     -e s/sun4u/sparc64/ /
     -e s/arm.*/arm/ /
     -e s/sa110/arm/ /
     -e s/powerpc/ppc/ /
     -e s/ppc64/ppc/ /
     -e s/macppc/ppc/)
 
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | /
#uname -s,得到kernel name,内核的名字
     sed -e 's//(cygwin/).*/cygwin/')
 
# Set shell to bash if possible, otherwise fall back to sh
SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; /
 else if [ -x /bin/bash ]; then echo /bin/bash; /
 else echo sh; fi; fi)
 
export HOSTARCH HOSTOS SHELL
 
# Deal with colliding definitions from tcsh etc.
VENDOR=
 
#########################################################################
# Allow for silent builds
ifeq (,$(findstring s,$(MAKEFLAGS)))
XECHO = echo
else
XECHO = :
endif
 
#########################################################################
#
# U-boot build supports producing a object files to the separate external
# directory. Two use cases are supported:
#
# 1) Add O= to the make command line
# 'make O="/tmp/build" all'
#
# 2) Set environement variable BUILD_DIR to point to the desired location
# 'export BUILD_DIR=/tmp/build'
# 'make'
#
# The second approach can also be used with a MAKEALL script
# 'export BUILD_DIR=/tmp/build'
# './MAKEALL'
#
# Command line 'O=' setting overrides BUILD_DIR environent variable.
#
# When none of the above methods is used the local build is performed and
# the object files are placed in the source directory.
#
#检查是否用O指定了编译目录,如果指定了则把值存入变量BUILD_DIR
ifdef O
ifeq ("$(origin O)", "command line")
BUILD_DIR := $(O)
endif
endif
 
#把变量BUILD_DIR的值存入saved-output
ifneq ($(BUILD_DIR),)
saved-output := $(BUILD_DIR)
 
# Attempt to create a output directory.
$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})     
#选项“-d”用来判断目录是否存在
 
#检查BUILD_DIR是否创建成功
# Verify if it was successful.
BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))   
#if(a,b,c)如果a为真则执行b否则执行cendif  
 
# ifneq ($(BUILD_DIR),)
 
#一些变量的赋值
OBJTREE  := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
SRCTREE  := $(CURDIR)
TOPDIR  := $(SRCTREE)
LNDIR  := $(OBJTREE)
export TOPDIR SRCTREE OBJTREE
 
MKCONFIG := $(SRCTREE)/mkconfig
export MKCONFIG
 
ifneq ($(OBJTREE),$(SRCTREE))
REMOTE_BUILD := 1
export REMOTE_BUILD
endif
 
# $(obj) and (src) are defined in config.mk but here in main Makefile
# we also need them before config.mk is included which is the case for
# some targets like unconfig, clean, clobber, distclean, etc.
ifneq ($(OBJTREE),$(SRCTREE))
obj := $(OBJTREE)/
src := $(SRCTREE)/
else
obj :=
src :=
endif
export obj src
 
# Make sure CDPATH settings don't interfere
unexport CDPATH
 
#########################################################################
 
ifeq ($(ARCH),powerpc)
ARCH = ppc
endif
 
ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))  
#'wildcard' 的函 数,它有一个参数,功能是展开成一列所有符合由其参数描述的文件名,文件间以空格间隔。
此句是判断$(obj)include/config.mk是否存在。『当调用make <boardname>_config后将生成config.mk』
 
# load ARCH, BOARD, and CPU configuration
include $(obj)include/config.mk   #把$(OBJTREE)/include/config.mk中的内容加在此处
export ARCH CPU BOARD VENDOR SOC
 
#根据ARCH的值对变量CROSS_COMPILE(最好把这个变量设为环境变量并置值)进行赋值,此值为交叉编译工具的开头部分名称
ifndef CROSS_COMPILE
ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE =
else
ifeq ($(ARCH),ppc)
CROSS_COMPILE = ppc_8xx-
endif
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
endif
ifeq ($(ARCH),i386)
CROSS_COMPILE = i386-linux-
endif
ifeq ($(ARCH),mips)
CROSS_COMPILE = mips_4KC-
endif
ifeq ($(ARCH),nios)
CROSS_COMPILE = nios-elf-
endif
ifeq ($(ARCH),nios2)
CROSS_COMPILE = nios2-elf-
endif
ifeq ($(ARCH),m68k)
CROSS_COMPILE = m68k-elf-
endif
ifeq ($(ARCH),microblaze)
CROSS_COMPILE = mb-
endif
ifeq ($(ARCH),blackfin)
CROSS_COMPILE = bfin-uclinux-
endif
ifeq ($(ARCH),avr32)
CROSS_COMPILE = avr32-linux-
endif
ifeq ($(ARCH),sh)
CROSS_COMPILE = sh4-linux-
endif
ifeq ($(ARCH),sparc)
CROSS_COMPILE = sparc-elf-
endif # sparc
endif # HOSTARCH,ARCH
endif # CROSS_COMPILE
 
export CROSS_COMPILE
 
# load other configuration
include $(TOPDIR)/config.mk  
#加入顶层config.mk文件内容,其中包含了对编译器的一些设置
 
#########################################################################
#一些编译选项变量的赋值,LIBS目标包含众多的.a库文件,都是通过进入到每个子目录中make得来的
# U-Boot objects....order is important (i.e. start must be first)
 
OBJS  = cpu/$(CPU)/start.o
ifeq ($(CPU),i386)
OBJS += cpu/$(CPU)/start16.o
OBJS += cpu/$(CPU)/reset.o
endif
ifeq ($(CPU),ppc4xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
ifeq ($(CPU),mpc85xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
 
OBJS := $(addprefix $(obj),$(OBJS))
 
LIBS  = lib_generic/libgeneric.a
LIBS += lib_generic/lzma/liblzma.a
LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo /
 "board/$(VENDOR)/common/lib$(VENDOR).a"; fi)
LIBS += cpu/$(CPU)/lib$(CPU).a
ifdef SOC
LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
endif
ifeq ($(CPU),ixp)
LIBS += cpu/ixp/npe/libnpe.a
endif
LIBS += lib_$(ARCH)/lib$(ARCH).a
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a /
 fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a
LIBS += net/libnet.a
LIBS += disk/libdisk.a
LIBS += drivers/bios_emulator/libatibiosemu.a
LIBS += drivers/block/libblock.a
LIBS += drivers/dma/libdma.a
LIBS += drivers/fpga/libfpga.a
LIBS += drivers/gpio/libgpio.a
LIBS += drivers/hwmon/libhwmon.a
LIBS += drivers/i2c/libi2c.a
LIBS += drivers/input/libinput.a
LIBS += drivers/misc/libmisc.a
LIBS += drivers/mmc/libmmc.a
LIBS += drivers/mtd/libmtd.a
LIBS += drivers/mtd/nand/libnand.a
LIBS += drivers/mtd/nand_legacy/libnand_legacy.a
LIBS += drivers/mtd/onenand/libonenand.a
LIBS += drivers/mtd/ubi/libubi.a
LIBS += drivers/mtd/spi/libspi_flash.a
LIBS += drivers/net/libnet.a
LIBS += drivers/net/phy/libphy.a
LIBS += drivers/net/sk98lin/libsk98lin.a
LIBS += drivers/pci/libpci.a
LIBS += drivers/pcmcia/libpcmcia.a
LIBS += drivers/spi/libspi.a
ifeq ($(CPU),mpc83xx)
LIBS += drivers/qe/qe.a
endif
ifeq ($(CPU),mpc85xx)
LIBS += drivers/qe/qe.a
LIBS += cpu/mpc8xxx/ddr/libddr.a
TAG_SUBDIRS += cpu/mpc8xxx
endif
ifeq ($(CPU),mpc86xx)
LIBS += cpu/mpc8xxx/ddr/libddr.a
TAG_SUBDIRS += cpu/mpc8xxx
endif
LIBS += drivers/rtc/librtc.a
LIBS += drivers/serial/libserial.a
LIBS += drivers/usb/libusb.a
LIBS += drivers/video/libvideo.a
LIBS += common/libcommon.a
LIBS += libfdt/libfdt.a
LIBS += api/libapi.a
LIBS += post/libpost.a
 
LIBS := $(addprefix $(obj),$(LIBS))
.PHONY : $(LIBS) $(TIMESTAMP_FILE) $(VERSION_FILE)
 
LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
# Add GCC lib
PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
 
# The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS)
SUBDIRS = tools /
   examples /
   api_examples
 
.PHONY : $(SUBDIRS)
 
ifeq ($(CONFIG_NAND_U_BOOT),y)
NAND_SPL = nand_spl
U_BOOT_NAND = $(obj)u-boot-nand.bin
endif
 
ifeq ($(CONFIG_ONENAND_U_BOOT),y)
ONENAND_IPL = onenand_ipl
U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
endif
 
__OBJS := $(subst $(obj),,$(OBJS))
__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
#########################################################################
#########################################################################
#以下生成uboot.bin等文件
 
ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)
ifeq ($(ARCH),blackfin)
ALL += $(obj)u-boot.ldr
endif
 
all:  $(ALL)
 
$(obj)u-boot.hex: $(obj)u-boot
  $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
 
$(obj)u-boot.srec: $(obj)u-boot
  $(OBJCOPY) -O srec $< $@
 
$(obj)u-boot.bin: $(obj)u-boot
  $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
 
$(obj)u-boot.ldr: $(obj)u-boot
  $(LDR) -T $(CONFIG_BFIN_CPU) -f -c $@ $< $(LDR_FLAGS)
 
$(obj)u-boot.ldr.hex: $(obj)u-boot.ldr
  $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
 
$(obj)u-boot.ldr.srec: $(obj)u-boot.ldr
  $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
 
$(obj)u-boot.img: $(obj)u-boot.bin
  ./tools/mkimage -A $(ARCH) -T firmware -C none /
  -a $(TEXT_BASE) -e 0 /
  -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | /
   sed -e 's/"[  ]*$$/ for $(BOARD) board"/') /
  -d $< $@
 
$(obj)u-boot.sha1: $(obj)u-boot.bin
  $(obj)tools/ubsha1 $(obj)u-boot.bin
 
$(obj)u-boot.dis: $(obj)u-boot
  $(OBJDUMP) -d $< > $@
 
$(obj)u-boot:  depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
  UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | /
  sed  -n -e 's/.*/($(SYM_PREFIX)__u_boot_cmd_.*/)/-u/1/p'|sort|uniq`;/
  cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) /
   --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) /
   -Map u-boot.map -o u-boot
 
$(OBJS): depend $(obj)include/autoconf.mk
  $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
$(LIBS): depend $(obj)include/autoconf.mk $(SUBDIRS)
  $(MAKE) -C $(dir $(subst $(obj),,$@))
 
$(LIBBOARD): depend $(LIBS) $(obj)include/autoconf.mk
  $(MAKE) -C $(dir $(subst $(obj),,$@))
 
$(SUBDIRS): depend $(obj)include/autoconf.mk
  $(MAKE) -C $@ all
 
$(LDSCRIPT): depend $(obj)include/autoconf.mk
  $(MAKE) -C $(dir $@) $(notdir $@)
 
$(NAND_SPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
  $(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
$(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
  cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
 
$(ONENAND_IPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
  $(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
 
$(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
  cat $(obj)onenand_ipl/onenand-ipl-2k.bin $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
  cat $(obj)onenand_ipl/onenand-ipl-4k.bin $(obj)u-boot.bin > $(obj)u-boot-flexonenand.bin
 
$(VERSION_FILE):
  @( printf '#define U_BOOT_VERSION "U-Boot %s%s"/n' "$(U_BOOT_VERSION)" /
   '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > [email protected]
  @cmp -s $@ [email protected] && rm -f [email protected] || mv -f [email protected] $@
 
$(TIMESTAMP_FILE):
  @date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
  @date +'#define U_BOOT_TIME "%T"' >> $@
 
gdbtools:
  $(MAKE) -C tools/gdb all || exit 1
 
updater:
  $(MAKE) -C tools/updater all || exit 1
 
env:
  $(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1
 
depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE)
  for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
 
TAG_SUBDIRS += include
TAG_SUBDIRS += lib_generic board/$(BOARDDIR)
TAG_SUBDIRS += cpu/$(CPU)
TAG_SUBDIRS += lib_$(ARCH)
TAG_SUBDIRS += fs/cramfs
TAG_SUBDIRS += fs/fat
TAG_SUBDIRS += fs/fdos
TAG_SUBDIRS += fs/jffs2
TAG_SUBDIRS += fs/yaffs2
TAG_SUBDIRS += net
TAG_SUBDIRS += disk
TAG_SUBDIRS += common
TAG_SUBDIRS += drivers/bios_emulator
TAG_SUBDIRS += drivers/block
TAG_SUBDIRS += drivers/gpio
TAG_SUBDIRS += drivers/hwmon
TAG_SUBDIRS += drivers/i2c
TAG_SUBDIRS += drivers/input
TAG_SUBDIRS += drivers/misc
TAG_SUBDIRS += drivers/mmc
TAG_SUBDIRS += drivers/mtd
TAG_SUBDIRS += drivers/mtd/nand
TAG_SUBDIRS += drivers/mtd/nand_legacy
TAG_SUBDIRS += drivers/mtd/onenand
TAG_SUBDIRS += drivers/mtd/spi
TAG_SUBDIRS += drivers/net
TAG_SUBDIRS += drivers/net/sk98lin
TAG_SUBDIRS += drivers/pci
TAG_SUBDIRS += drivers/pcmcia
TAG_SUBDIRS += drivers/qe
TAG_SUBDIRS += drivers/rtc
TAG_SUBDIRS += drivers/serial
TAG_SUBDIRS += drivers/spi
TAG_SUBDIRS += drivers/usb
TAG_SUBDIRS += drivers/video
 
tags ctags:
  ctags -w -o $(obj)ctags `find $(SUBDIRS) $(TAG_SUBDIRS) /
      -name '*.[ch]' -print`
 
etags:
  etags -a -o $(obj)etags `find $(SUBDIRS) $(TAG_SUBDIRS) /
      -name '*.[ch]' -print`
cscope:
  find $(SUBDIRS) $(TAG_SUBDIRS) -name '*.[ch]' -print /
      > cscope.files
  cscope -b -q -k
 
$(obj)System.map: $(obj)u-boot
  @$(NM) $< | /
  grep -v '/(compiled/)/|/(/.o$$/)/|/( [aUw] /)/|/(/./.ng$$/)/|/(LASH[RL]DI/)' | /
  sort > $(obj)System.map
 
#
# 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 $(HOST_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] $@
 
sinclude $(obj)include/autoconf.mk.dep
 
#########################################################################
else      # !config.mk
#$(obj)/include/config.mk不存在就把所有的目标指到@echo "System not configured - see README" >&2,>&2为标准错误重定
all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin /
$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot /
$(SUBDIRS) $(TIMESTAMP_FILE) $(VERSION_FILE) gdbtools updater env depend /
dep tags ctags etags cscope $(obj)System.map:
 @echo "System not configured - see README" >&2
 @ exit 1
endif      # config.mk
 
.PHONY : CHANGELOG
CHANGELOG:
 git log --no-merges U-Boot-1_1_5.. | /
 unexpand -a | sed -e 's//s/s*$$//' > $@
 
include/license.h: tools/bin2header COPYING
  cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
#########################################################################
 
#删除上次编译时生成的配置文件,保证重新生成文件的纯粹性
unconfig:
 @rm -f $(obj)include/config.h $(obj)include/config.mk /
  $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp /
  $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
 
#以下是针对激突的体系结构生成config.mk的target
#========================================================================
# PowerPC
#========================================================================
 
----------------中间省略N多,其实都是一样的-----------------------------
#========================================================================
# ARM
#========================================================================
#########################################################################
## StrongARM Systems
#########################################################################
 
assabet_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm sa1100 assabet
 
dnp1110_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm sa1100 dnp1110
 
gcplus_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm sa1100 gcplus
 
lart_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm sa1100 lart
 
shannon_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm sa1100 shannon
 
#########################################################################
## ARM92xT Systems
#########################################################################
 
#########################################################################
## Atmel AT91RM9200 Systems
#########################################################################
 
at91rm9200dk_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t at91rm9200dk atmel at91rm9200
 
cmc_pu2_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t cmc_pu2 NULL at91rm9200
 
csb637_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t csb637 NULL at91rm9200
 
kb9202_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t kb9202 NULL at91rm9200
 
m501sk_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t m501sk NULL at91rm9200
 
mp2usb_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t mp2usb NULL at91rm9200
 
#########################################################################
## Atmel ARM926EJ-S Systems
#########################################################################
 
afeb9260_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs afeb9260 NULL at91
 
at91cap9adk_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs at91cap9adk atmel at91
 
at91sam9260ek_nandflash_config /
at91sam9260ek_dataflash_cs0_config /
at91sam9260ek_dataflash_cs1_config /
at91sam9260ek_config : unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _nandflash,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_NANDFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in NAND FLASH" ; /
 elif [ "$(findstring dataflash_cs0,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_DATAFLASH_CS0 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; /
 else /
  echo "#define CONFIG_SYS_USE_DATAFLASH_CS1 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS1" ; /
 fi;
 @$(MKCONFIG) -a at91sam9260ek arm arm926ejs at91sam9260ek atmel at91
 
at91sam9xeek_nandflash_config /
at91sam9xeek_dataflash_cs0_config /
at91sam9xeek_dataflash_cs1_config /
at91sam9xeek_config : unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _nandflash,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_NANDFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in NAND FLASH" ; /
 elif [ "$(findstring dataflash_cs0,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_DATAFLASH_CS0 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; /
 else /
  echo "#define CONFIG_SYS_USE_DATAFLASH_CS1 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS1" ; /
 fi;
 @$(MKCONFIG) -n at91sam9xeek -a at91sam9260ek arm arm926ejs at91sam9260ek atmel at91sam9
 
at91sam9261ek_nandflash_config /
at91sam9261ek_dataflash_cs0_config /
at91sam9261ek_dataflash_cs3_config /
at91sam9261ek_config : unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _nandflash,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_NANDFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in NAND FLASH" ; /
 elif [ "$(findstring dataflash_cs3,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_DATAFLASH_CS3 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS3" ; /
 else /
  echo "#define CONFIG_SYS_USE_DATAFLASH_CS0 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; /
 fi;
 @$(MKCONFIG) -a at91sam9261ek arm arm926ejs at91sam9261ek atmel at91
 
at91sam9263ek_nandflash_config /
at91sam9263ek_dataflash_config /
at91sam9263ek_dataflash_cs0_config /
at91sam9263ek_config : unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _nandflash,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_NANDFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in NAND FLASH" ; /
 else /
  echo "#define CONFIG_SYS_USE_DATAFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; /
 fi;
 @$(MKCONFIG) -a at91sam9263ek arm arm926ejs at91sam9263ek atmel at91
 
at91sam9rlek_nandflash_config /
at91sam9rlek_dataflash_config /
at91sam9rlek_dataflash_cs0_config /
at91sam9rlek_config : unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _nandflash,$@)" ] ; then /
  echo "#define CONFIG_SYS_USE_NANDFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in NAND FLASH" ; /
 else /
  echo "#define CONFIG_SYS_USE_DATAFLASH 1" >>$(obj)include/config.h ; /
  $(XECHO) "... with environment variable in SPI DATAFLASH CS0" ; /
 fi;
 @$(MKCONFIG) -a at91sam9rlek arm arm926ejs at91sam9rlek atmel at91
 
########################################################################
## ARM Integrator boards - see doc/README-integrator for more info.
integratorap_config /
ap_config  /
ap966_config  /
ap922_config  /
ap922_XA10_config /
ap7_config  /
ap720t_config  /
ap920t_config  /
ap926ejs_config  /
ap946es_config: unconfig
 @board/integratorap/split_by_variant.sh $@
 
integratorcp_config /
cp_config  /
cp920t_config  /
cp926ejs_config  /
cp946es_config  /
cp1136_config  /
cp966_config  /
cp922_config  /
cp922_XA10_config /
cp1026_config: unconfig
 @board/integratorcp/split_by_variant.sh $@
 
davinci_dvevm_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs dvevm davinci davinci
 
davinci_schmoogie_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs schmoogie davinci davinci
 
davinci_sffsdr_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs sffsdr davinci davinci
 
davinci_sonata_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs sonata davinci davinci
 
lpd7a400_config /
lpd7a404_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm lh7a40x lpd7a40x
 
mx1ads_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t mx1ads NULL imx
 
mx1fs2_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t mx1fs2 NULL imx
 
netstar_config:  unconfig
 @$(MKCONFIG) $(@:_config=) arm arm925t netstar
 
omap1510inn_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm925t omap1510inn
 
xtract_omap1610xxx = $(subst _cs0boot,,$(subst _cs3boot,,$(subst _cs_autoboot,,$(subst _config,,$1))))
 
omap1610inn_config /
omap1610inn_cs0boot_config /
omap1610inn_cs3boot_config /
omap1610inn_cs_autoboot_config /
omap1610h2_config /
omap1610h2_cs0boot_config /
omap1610h2_cs3boot_config /
omap1610h2_cs_autoboot_config: unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _cs0boot_, $@)" ] ; then /
  echo "#define CONFIG_CS0_BOOT" >> .$(obj)include/config.h ; /
  $(XECHO) "... configured for CS0 boot"; /
 elif [ "$(findstring _cs_autoboot_, $@)" ] ; then /
  echo "#define CONFIG_CS_AUTOBOOT" >> $(obj)include/config.h ; /
  $(XECHO) "... configured for CS_AUTO boot"; /
 else /
  echo "#define CONFIG_CS3_BOOT" >> $(obj)include/config.h ; /
  $(XECHO) "... configured for CS3 boot"; /
 fi;
 @$(MKCONFIG) -a $(call xtract_omap1610xxx,$@) arm arm926ejs omap1610inn NULL omap
 
omap5912osk_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm926ejs omap5912osk NULL omap
 
xtract_omap730p2 = $(subst _cs0boot,,$(subst _cs3boot,, $(subst _config,,$1)))
 
omap730p2_config /
omap730p2_cs0boot_config /
omap730p2_cs3boot_config : unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring _cs0boot_, $@)" ] ; then /
  echo "#define CONFIG_CS0_BOOT" >> $(obj)include/config.h ; /
  $(XECHO) "... configured for CS0 boot"; /
 else /
  echo "#define CONFIG_CS3_BOOT" >> $(obj)include/config.h ; /
  $(XECHO) "... configured for CS3 boot"; /
 fi;
 @$(MKCONFIG) -a $(call xtract_omap730p2,$@) arm arm926ejs omap730p2 NULL omap
 
sbc2410x_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
scb9328_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
smdk2400_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t smdk2400 NULL s3c24x0
 
smdk2410_config : unconfig    #首先删除上次编译的配置文件
 @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
#行首都@表示在make时不输出make的信息,$(MKCONFIG) 将执行$(SRCTREE)/mkconfig脚本文件,$(@:_config=)为将传进来的所有参数中的_config替换为空『此中的@表示输入进来的所有参数,$(a:patternA=patternB),这样的语法表示把a变量里的形式为patternA的换成为patternB,然后输出。』 这句话实际是将smdk2410 arm arm920t smdk2410 NULL s3c24x0这六个参数传到mkconfig脚本中。
 
gateway_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t gateway NULL s3c24x0
 
SX1_config :  unconfig
 @$(MKCONFIG) $(@:_config=) arm arm925t sx1
 
# TRAB default configuration: 8 MB Flash, 32 MB RAM
xtract_trab = $(subst _bigram,,$(subst _bigflash,,$(subst _old,,$(subst _config,,$1))))
 
trab_config /
trab_bigram_config /
trab_bigflash_config /
trab_old_config: unconfig
 @mkdir -p $(obj)include
 @mkdir -p $(obj)board/trab
 @[ -z "$(findstring _bigram,$@)" ] || /
  { echo "#define CONFIG_FLASH_8MB"  >>$(obj)include/config.h ; /
    echo "#define CONFIG_RAM_32MB"   >>$(obj)include/config.h ; /
    $(XECHO) "... with 8 MB Flash, 32 MB RAM" ; /
  }
 @[ -z "$(findstring _bigflash,$@)" ] || /
  { echo "#define CONFIG_FLASH_16MB" >>$(obj)include/config.h ; /
    echo "#define CONFIG_RAM_16MB"   >>$(obj)include/config.h ; /
    $(XECHO) "... with 16 MB Flash, 16 MB RAM" ; /
    echo "TEXT_BASE = 0x0CF40000" >$(obj)board/trab/config.tmp ; /
  }
 @[ -z "$(findstring _old,$@)" ] || /
  { echo "#define CONFIG_FLASH_8MB"  >>$(obj)include/config.h ; /
    echo "#define CONFIG_RAM_16MB"   >>$(obj)include/config.h ; /
    $(XECHO) "... with 8 MB Flash, 16 MB RAM" ; /
    echo "TEXT_BASE = 0x0CF40000" >$(obj)board/trab/config.tmp ; /
  }
 @$(MKCONFIG) -a $(call xtract_trab,$@) arm arm920t trab NULL s3c24x0
 
VCMA9_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t vcma9 mpl s3c24x0
 
#########################################################################
# ARM supplied Versatile development boards
#########################################################################
 
cm4008_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t cm4008 NULL ks8695
 
cm41xx_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm920t cm41xx NULL ks8695
 
versatile_config /
versatileab_config /
versatilepb_config : unconfig
 @board/versatile/split_by_variant.sh $@
 
voiceblue_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm arm925t voiceblue
 
#########################################################################
## S3C44B0 Systems
#########################################################################
 
B2_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm s3c44b0 B2 dave
 
#########################################################################
## ARM720T Systems
#########################################################################
 
armadillo_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t armadillo
 
ep7312_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t ep7312
 
impa7_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t impa7
 
modnet50_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t modnet50
 
evb4510_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t evb4510
 
lpc2292sodimm_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t lpc2292sodimm NULL lpc2292
 
SMN42_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm720t SMN42 siemens lpc2292
 
#########################################################################
## XScale Systems
#########################################################################
 
actux1_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm ixp actux1
 
actux2_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm ixp actux2
 
actux3_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm ixp actux3
 
actux4_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm ixp actux4
 
cerf250_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa cerf250
 
cradle_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa cradle
 
csb226_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa csb226
 
delta_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa delta
 
innokom_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa innokom
 
ixdp425_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm ixp ixdp425
 
ixdpg425_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm ixp ixdp425
 
lubbock_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa lubbock
 
pleb2_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa pleb2
 
logodl_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa logodl
 
pdnb3_config /
scpu_config: unconfig
 @mkdir -p $(obj)include
 @if [ "$(findstring scpu_,$@)" ] ; then /
  echo "#define CONFIG_SCPU" >>$(obj)include/config.h ; /
  $(XECHO) "... on SCPU board variant" ; /
 fi
 @$(MKCONFIG) -a pdnb3 arm ixp pdnb3 prodrive
 
pxa255_idp_config: unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa pxa255_idp
 
trizepsiv_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa trizepsiv
 
wepep250_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa wepep250
 
xaeniax_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa xaeniax
 
xm250_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa xm250
 
xsengine_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm pxa xsengine
 
zylonite_config :
 @$(MKCONFIG) $(@:_config=) arm pxa zylonite
 
#########################################################################
## ARM1136 Systems
#########################################################################
 
apollon_config  : unconfig
 @mkdir -p $(obj)include
 @mkdir -p $(obj)onenand_ipl/board/apollon
 @echo "#define CONFIG_ONENAND_U_BOOT" > $(obj)include/config.h
 @$(MKCONFIG) $(@:_config=) arm arm1136 apollon NULL omap24xx
 @echo "CONFIG_ONENAND_U_BOOT = y" >> $(obj)include/config.mk
 
imx31_litekit_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm1136 imx31_litekit NULL mx31
 
imx31_phycore_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
 
mx31ads_config  : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
 
omap2420h4_config : unconfig
 @$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xx
 
#########################################################################
## ARM1176 Systems
#########################################################################
smdk6400_noUSB_config /
smdk6400_config : unconfig
 @mkdir -p $(obj)include $(obj)board/samsung/smdk6400
 @mkdir -p $(obj)nand_spl/board/samsung/smdk6400
 @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
 @if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then   /
  echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;/
  $(MKCONFIG) $(@:_config=) arm arm1176 smdk6400 samsung s3c64xx;  /
 else          /
  echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;/
  $(MKCONFIG) $(@:_noUSB_config=) arm arm1176 smdk6400 samsung s3c64xx; /
 fi
 @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
 
#========================================================================
# i386
#========================================================================
#########################################################################
## AMD SC520 CDP
#########################################################################
sc520_cdp_config : unconfig
 @$(MKCONFIG) $(@:_config=) i386 i386 sc520_cdp
 
sc520_spunk_config : unconfig
 @$(MKCONFIG) $(@:_config=) i386 i386 sc520_spunk
 
sc520_spunk_rel_config : unconfig
 @$(MKCONFIG) $(@:_config=) i386 i386 sc520_spunk
 
#========================================================================
# MIPS
#========================================================================
#########################################################################
## MIPS32 4Kc
#########################################################################
 
xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
 
incaip_100MHz_config /
incaip_133MHz_config /
incaip_150MHz_config /
incaip_config: unconfig
 @mkdir -p $(obj)include
 @[ -z "$(findstring _100MHz,$@)" ] || /
  { echo "#define CPU_CLOCK_RATE 100000000" >>$(obj)include/config.h ; /
    $(XECHO) "... with 100MHz system clock" ; /
  }
 @[ -z "$(findstring _133MHz,$@)" ] || /
  { echo "#define CPU_CLOCK_RATE 133000000" >>$(obj)include/config.h ; /
    $(XECHO) "... with 133MHz system clock" ; /
  }
 @[ -z "$(findstring _150MHz,$@)" ] || /
  { echo "#define CPU_CLOCK_RATE 150000000" >>$(obj)include/config.h ; /
    $(XECHO) "... with 150MHz system clock" ; /
  }
 @$(MKCONFIG) -a $(call xtract_incaip,$@) mips mips incaip
 
tb0229_config: unconfig
 @$(MKCONFIG) $(@:_config=) mips mips tb0229
 
#########################################################################
## MIPS32 AU1X00
#########################################################################
 
dbau1000_config  : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_DBAU1000 1" >$(obj)include/config.h
 @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
dbau1100_config  : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_DBAU1100 1" >$(obj)include/config.h
 @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
dbau1500_config  : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_DBAU1500 1" >$(obj)include/config.h
 @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
dbau1550_config  : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h
 @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
dbau1550_el_config : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h
 @$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
gth2_config  : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_GTH2 1" >$(obj)include/config.h
 @$(MKCONFIG) -a gth2 mips mips gth2
 
pb1000_config  : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_PB1000 1" >$(obj)include/config.h
 @$(MKCONFIG) -a pb1x00 mips mips pb1x00
 
qemu_mips_config : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_QEMU_MIPS 1" >$(obj)include/config.h
 @$(MKCONFIG) -a qemu-mips mips mips qemu-mips
 
#########################################################################
## MIPS64 5Kc
#########################################################################
 
purple_config :  unconfig
 @$(MKCONFIG) $(@:_config=) mips mips purple
 
#========================================================================
# Nios
#========================================================================
#########################################################################
## Nios32
#########################################################################
 
ADNPESC1_DNPEVA2_base_32_config /
ADNPESC1_base_32_config  /
ADNPESC1_config: unconfig
 @mkdir -p $(obj)include
 @[ -z "$(findstring _DNPEVA2,$@)" ] || /
  { echo "#define CONFIG_DNPEVA2 1" >>$(obj)include/config.h ; /
    $(XECHO) "... DNP/EVA2 configuration" ; /
  }
 @[ -z "$(findstring _base_32,$@)" ] || /
  { echo "#define CONFIG_NIOS_BASE_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'base_32' configuration" ; /
  }
 @[ -z "$(findstring ADNPESC1_config,$@)" ] || /
  { echo "#define CONFIG_NIOS_BASE_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'base_32' configuration (DEFAULT)" ; /
  }
 @$(MKCONFIG) -a ADNPESC1 nios nios adnpesc1 ssv
 
DK1C20_safe_32_config  /
DK1C20_standard_32_config /
DK1C20_config: unconfig
 @mkdir -p $(obj)include
 @[ -z "$(findstring _safe_32,$@)" ] || /
  { echo "#define CONFIG_NIOS_SAFE_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'safe_32' configuration" ; /
  }
 @[ -z "$(findstring _standard_32,$@)" ] || /
  { echo "#define CONFIG_NIOS_STANDARD_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'standard_32' configuration" ; /
  }
 @[ -z "$(findstring DK1C20_config,$@)" ] || /
  { echo "#define CONFIG_NIOS_STANDARD_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'standard_32' configuration (DEFAULT)" ; /
  }
 @$(MKCONFIG) -a DK1C20 nios nios dk1c20 altera
 
DK1S10_safe_32_config  /
DK1S10_standard_32_config /
DK1S10_mtx_ldk_20_config /
DK1S10_config: unconfig
 @mkdir -p $(obj)include
 @[ -z "$(findstring _safe_32,$@)" ] || /
  { echo "#define CONFIG_NIOS_SAFE_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'safe_32' configuration" ; /
  }
 @[ -z "$(findstring _standard_32,$@)" ] || /
  { echo "#define CONFIG_NIOS_STANDARD_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'standard_32' configuration" ; /
  }
 @[ -z "$(findstring _mtx_ldk_20,$@)" ] || /
  { echo "#define CONFIG_NIOS_MTX_LDK_20 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'mtx_ldk_20' configuration" ; /
  }
 @[ -z "$(findstring DK1S10_config,$@)" ] || /
  { echo "#define CONFIG_NIOS_STANDARD_32 1" >>$(obj)include/config.h ; /
    $(XECHO) "... NIOS 'standard_32' configuration (DEFAULT)" ; /
  }
 @$(MKCONFIG) -a DK1S10 nios nios dk1s10 altera
 
#########################################################################
## Nios-II
#########################################################################
 
EP1C20_config : unconfig
 @$(MKCONFIG)  EP1C20 nios2 nios2 ep1c20 altera
 
EP1S10_config : unconfig
 @$(MKCONFIG)  EP1S10 nios2 nios2 ep1s10 altera
 
EP1S40_config : unconfig
 @$(MKCONFIG)  EP1S40 nios2 nios2 ep1s40 altera
 
PK1C20_config : unconfig
 @$(MKCONFIG)  PK1C20 nios2 nios2 pk1c20 psyent
 
PCI5441_config : unconfig
 @$(MKCONFIG)  PCI5441 nios2 nios2 pci5441 psyent
 
#========================================================================
## Microblaze
#========================================================================
 
ml401_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_ML401 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) microblaze microblaze ml401 xilinx
 
suzaku_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_SUZAKU 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) microblaze microblaze suzaku AtmarkTechno
 
#========================================================================
# Blackfin
#========================================================================
 
# Analog Devices boards
BFIN_BOARDS = bf533-ezkit bf533-stamp bf537-stamp bf561-ezkit
 
$(BFIN_BOARDS:%=%_config) : unconfig
 @$(MKCONFIG) $(@:_config=) blackfin blackfin $(@:_config=)
 
$(BFIN_BOARDS):
 $(MAKE) $@_config
 $(MAKE)
 
#========================================================================
# AVR32
#========================================================================
 
atngw100_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap atngw100 atmel at32ap700x
 
atstk1002_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
atstk1003_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
atstk1004_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
atstk1006_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
favr-32-ezkit_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap favr-32-ezkit earthlcd at32ap700x
 
hammerhead_config : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap hammerhead miromico at32ap700x
 
mimc200_config  : unconfig
 @$(MKCONFIG) $(@:_config=) avr32 at32ap mimc200 mimc at32ap700x
 
#========================================================================
# SH3 (SuperH)
#========================================================================
 
#########################################################################
## sh2 (Renesas SuperH)
#########################################################################
rsk7203_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_RSK7203 1" > $(obj)/include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh2 rsk7203 renesas
 
#########################################################################
## sh3 (Renesas SuperH)
#########################################################################
 
mpr2_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_MPR2 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh3 mpr2
 
ms7720se_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_MS7720SE 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh3 ms7720se
 
#########################################################################
## sh4 (Renesas SuperH)
#########################################################################
 
MigoR_config :       unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_MIGO_R 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 MigoR renesas
 
ms7750se_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_MS7750SE 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 ms7750se
 
ms7722se_config : unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_MS7722SE 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 ms7722se
 
r2dplus_config  :   unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_R2DPLUS 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 r2dplus renesas
 
r7780mp_config: unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_R7780MP 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 r7780mp renesas
 
sh7763rdp_config  :   unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_SH7763RDP 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 sh7763rdp renesas
 
sh7785lcr_config  :   unconfig
 @ >include/config.h
 @echo "#define CONFIG_SH7785LCR 1" >> include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 sh7785lcr renesas
 
ap325rxa_config  :   unconfig
 @mkdir -p $(obj)include
 @echo "#define CONFIG_AP325RXA 1" > $(obj)include/config.h
 @$(MKCONFIG) -a $(@:_config=) sh sh4 ap325rxa renesas
 
#========================================================================
# SPARC
#========================================================================
 
#########################################################################
## LEON3
#########################################################################
 
# Gaisler GR-XC3S-1500 board
gr_xc3s_1500_config : unconfig
 @$(MKCONFIG) $(@:_config=) sparc leon3 gr_xc3s_1500 gaisler
 
# Gaisler GR-CPCI-AX2000 board, a General purpose FPGA-AX system
gr_cpci_ax2000_config : unconfig
 @$(MKCONFIG) $(@:_config=) sparc leon3 gr_cpci_ax2000 gaisler
 
# Gaisler GRLIB template design (GPL SPARC/LEON3) for Altera NIOS
# Development board Stratix II edition, FPGA Device EP2S60.
gr_ep2s60_config: unconfig
 @$(MKCONFIG) $(@:_config=) sparc leon3 gr_ep2s60 gaisler
 
# Gaisler LEON3 GRSIM simulator
grsim_config : unconfig
 @$(MKCONFIG) $(@:_config=) sparc leon3 grsim gaisler
 
#########################################################################
## LEON2
#########################################################################
 
# Gaisler LEON2 GRSIM simulator
grsim_leon2_config : unconfig
 @$(MKCONFIG) $(@:_config=) sparc leon2 grsim_leon2 gaisler
 
#########################################################################
#########################################################################
#########################################################################
#clean目标
clean:
 @rm -f $(obj)examples/82559_eeprom $(obj)examples/eepro100_eeprom /
        $(obj)examples/hello_world  $(obj)examples/interrupt   /
        $(obj)examples/mem_to_mem_idma2intr     /
        $(obj)examples/sched    $(obj)examples/smc91111_eeprom /
        $(obj)examples/test_burst   $(obj)examples/timer
 @rm -f $(obj)tools/bmp_logo    $(obj)tools/easylogo/easylogo  /
        $(obj)tools/env/{fw_printenv,fw_setenv}     /
        $(obj)tools/envcrc       /
        $(obj)tools/gdb/{astest,gdbcont,gdbsend}     /
        $(obj)tools/gen_eth_addr    $(obj)tools/img2srec    /
        $(obj)tools/mkimage    $(obj)tools/mpc86x_clk   /
        $(obj)tools/ncb     $(obj)tools/ubsha1
 @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}   /
        $(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin}   /
        $(obj)board/trab/trab_fkt   $(obj)board/voiceblue/eeprom   /
        $(obj)board/{integratorap,integratorcp}/u-boot.lds   /
        $(obj)board/{bf533-ezkit,bf533-stamp,bf537-stamp,bf561-ezkit}/u-boot.lds /
        $(obj)cpu/blackfin/bootrom-asm-offsets.[chs]
 @rm -f $(obj)include/bmp_logo.h
 @rm -f $(obj)nand_spl/{u-boot-spl,u-boot-spl.map,System.map}
 @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map}
 @rm -f $(obj)api_examples/demo $(TIMESTAMP_FILE) $(VERSION_FILE)
 @find $(OBJTREE) -type f /
  /( -name 'core' -o -name '*.bak' -o -name '*~' /
  -o -name '*.o' -o -name '*.a' /) -print /
  | xargs rm -f
 
clobber: clean
 @find $(OBJTREE) -type f /( -name .depend /
  -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img /) /
  -print0 /
  | xargs -0 rm -f
 @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS /
  $(obj)cscope.* $(obj)*.*~
 @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
 @rm -f $(obj)tools/{crc32.c,env_embedded.c,env/crc32.c,md5.c,sha1.c,inca-swap-bytes}
 @rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c,zlib.h}
 @rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
 @rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
 @[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
 @[ ! -d $(obj)api_examples ] || find $(obj)api_examples -name "*" -type l -print | xargs rm -f
 
ifeq ($(OBJTREE),$(SRCTREE))
mrproper /
distclean: clobber unconfig
else
mrproper /
distclean: clobber unconfig
 rm -rf $(obj)*
endif
 
backup:
 F=`basename $(TOPDIR)` ; cd .. ; /
 gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
 
#########################################################################
 
跟顶层Makefile最紧密联系的就是顶层的mkconfig文件,简单注释了一下如下:
#!/bin/sh -e
 
# Script to create header files and links to configure
# U-Boot for a specific board.
#
# Parameters:  Target  Architecture  CPU  Board [VENDOR] [SOC]
#
# (C) 2002-2006 DENX Software Engineering, Wolfgang Denk < [email protected]>
#
 
APPEND=no # Default: Create new config file
BOARD_NAME="" # Name to print in make output
 
#这个循环在实际编译过程中并没有调用
while [ $# -gt 0 ] ; do
#$#表示输入进来的参数个数,-gt(great than)表示左边大于右边则返回真
#SHELL常用内部参数:  
 $# ----传递给程序的总的参数数目
   $? ----上一个代码或者shell程序在shell中退出的情况,如果正常退出则返回0,反之为非0值。
   $* ----传递给程序的所有参数组成的字符串。
      $n ----表示第几个参数,$1 表示第一个参数,$2 表示第二个参数 ...
      $0 ----当前程序的名称
      $@----以"参数1" "参数2" ... 形式保存所有参数
      $$ ----本程序的(进程ID号)PID
      $!  ----上一个命令的PID
 case "$1" in
 --) shift ; break ;;
 -a) shift ; APPEND="yes" ;;
 -n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
 *)  break ;;
 esac
done
 
[ "${BOARD_NAME}" ] || BOARD_NAME="$1" #$1表示第一个参数  
 
[ $# -lt 4 ] && exit 1                  #-lt(less than)表示左边小于右边则返回真  
[ $# -gt 6 ] && exit 1
 
echo "Configuring for ${BOARD_NAME} board..."
 
#
# Create link to architecture specific headers
#
#根据传入的参数创建文件连接
if [ "$SRCTREE" != "$OBJTREE" ] ; then
 mkdir -p ${OBJTREE}/include
 mkdir -p ${OBJTREE}/include2
 cd ${OBJTREE}/include2
 rm -f asm
 ln -s ${SRCTREE}/include/asm-$2 asm
 LNPREFIX="../../include2/asm/"
 cd ../include
 rm -rf asm-$2
 rm -f asm
 mkdir asm-$2
 ln -s asm-$2 asm
else
 cd ./include
 rm -f asm
 ln -s asm-$2 asm
fi
 
rm -f asm-$2/arch
 
if [ -z "$6" -o "$6" = "NULL" ] ; then
 ln -s ${LNPREFIX}arch-$3 asm-$2/arch
else
 ln -s ${LNPREFIX}arch-$6 asm-$2/arch
fi
 
if [ "$2" = "arm" ] ; then
 rm -f asm-$2/proc
 ln -s ${LNPREFIX}proc-armv asm-$2/proc
fi
 
#
# Create include file for Make
#
#创建config.mk文件
echo "ARCH   = $2" >  config.mk
echo "CPU    = $3" >> config.mk
echo "BOARD  = $4" >> config.mk
 
[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
 
[ "$6" ] && [ "$6" != "NULL" ] && echo "SOC    = $6" >> config.mk
 
#
# Create board specific header file
#
if [ "$APPEND" = "yes" ] # Append to existing config file
then
 echo >> config.h
else
 > config.h  # Create new config file
fi
echo "/* Automatically generated - do not edit */" >>config.h
echo "#include <configs/$1.h>" >>config.h
 
exit 0
 
#正常执行本脚本后应该会在./include中生成两个文件:config.mk和config.h并且会将输入的参数传递到ARCH、CPU、BOARD、VENDOR、SOC几个变量中
 

你可能感兴趣的:(uboot-顶层Makefile注释)