u-boot Makefile源码注解

来源:互联网 发布:struts2 demo源码下载 编辑:程序博客网 时间:2024/04/30 02:16

cpci5200为例,顺序分析U-BOOT根目录下的顶层Makefile大致的流程及结构如下:

#

# (C) Copyright 2000-2006

# Wolfgang Denk, DENX Software Engineering, wd@denx.de.

#

# 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

#

 

#版本信息1.1.6版,定义版本文件变量

VERSION = 1

PATCHLEVEL = 1

SUBLEVEL = 5

EXTRAVERSION =

U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

VERSION_FILE = $(obj)include/version_autogenerated.h

 

#检查宿主机环境,这部分是常量的定义,注意这里的$(obj),这个常量在这里为空,它放#到这里,是因为在target unconfig, clean, clobber, distclean中需要用这个变量,#具体是个怎么用法,我没有去仔细分析。

#HOSTARCH这个变量的赋值,是通过执行一套shell程序来完成的,其中$(shell xxx) #的语法就是在shell中执行xxx的命令。这里的|就是linux中的管道处理符,/就是换行的#连接符,表示下一行与本行是同行程序处理。

#uname -m,就是得到machine hardware name,中文翻译成机器硬件名?!

#sed -e的意思,就是表示后面跟的是一串命令脚本,s/abc/def/的命令表达式,就是表#示要从标准输入中,查找到内容为abc的,然后替换成def。这样执行这一套程序下来,就#知道了机器的硬件体系了。

#uname -s,得到kernel name,内核的名字。

#tr '[:upper:]' '[:lower:]',表示从标准输入里,把大字都换成小写,然后输出到标准#输出。然后后面再跟了一串用来特别处理cygwin环境下编译的环境变量的配置的。

 

HOSTARCH := $(shell uname -m | /

       sed -e s/i.86/i386/ /

           -e s/sun4u/sparc64/ /

           -e s/arm.*/arm/ /

           -e s/sa110/arm/ /

           -e s/powerpc/ppc/ /

           -e s/macppc/ppc/)

 

HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | /

           sed -e 's//(cygwin/).*/cygwin/')

 

export    HOSTARCH HOSTOS

 

# Deal with colliding definitions from tcsh etc.

VENDOR=

 

#########################################################################

#定义源码及生成的目标文件存放的目录,目标文件存放目录BUILD_DIR可以通过

#make O=dir 指定。如果没有指定,则设定为源码顶层目录。一般编译的时候不

#指定输出目录,则BUILD_DIR为空。

#

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

#

 

#使用一个条件判断,判断0这个变量有没有被定义,如果定义了,则进一步判断,这个0的定#义是从哪里来的,$(origin 0)就是来得到0的定义的来源,如果是命令行,则采用。同理如#果BUILD_DIR变量不为空,则给另外一个变量saved-output赋值。

ifdef O

ifeq ("$(origin O)", "command line")

BUILD_DIR := $(O)

endif

endif

 

ifneq ($(BUILD_DIR),)

saved-output := $(BUILD_DIR)

 

# Attempt to create a output directory.

#执行shell的时候,用了一个||符号,这个符号的功能与C语言里的||符号功能很相似,如果#左边的值为真,则不执行后面的操作。所以这里就是先用-d选项判断${BUILD_DIR}这个目录#存在与否,如果存在,就不执行后面的建目录的命令,如果不存在,则建目录。

$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})

 

# Verify if it was successful.

#接下来这一段就是执行cd命令,进入到新建的目录里,然后执行pwd命令来得到当前目录的

#真实位置。为什么需要这样做呢,因为前面的创建目录工作可能不成功,所以导致后面的cd

#命令也没有进去,所以需要后面的pwd命令来确认一下。接下来的if用了一个三段式的形式,#if(a,b,c)这样的形式,执行步骤为,先判断a的真假,如果为真,则执行b,如果为假,则

#执行c。所以这里的意思就是判断目录建成没有建成,如果建成,则什么也不干,没建成,

#就使用error,输出错误信息且退出。

BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)

$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))

endif # ifneq ($(BUILD_DIR),)

 

#下面是普通的变量赋值,其它目录变量定义如下,OBJTREE和LNDIR为存放生成文件的目#录,TOPDIR与SRCTREE为源码所在目录

OBJTREE            := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))

SRCTREE           := $(CURDIR)

TOPDIR              := $(SRCTREE)

LNDIR         := $(OBJTREE)

export    TOPDIR SRCTREE OBJTREE

 

#定义变量MKCONFIG:这个变量指向一个脚本,即顶层目录的mkconfig

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

 

#########################################################################

 

#判断$(OBJTREE)/include/config.mk与$(wildcard $(OBJTREE)/include/config.mk)得到

#的值是否一样。$(wildcard PATTERN)的使用就是查找到与PATTERN相符合的,并且是存在的,#以空格分开的文件列表。说白了,这句话就是判断$(OBJTREE)/include/config.mk文件是否#存在。如果存在,则执行后面用红色标记的内容,如果不存在,则执行接下去的内容,直到#红色标记部分。

#如果include/config.mk文件已存在,就从里面获取目标板构架信息

#否则就要执行者make xxx_config来生成该文件

#以下这部分直到红色标记处是在$(OBJTREE)/include/config.mk文件已经存在的情况下才

#执行的。

ifeq ($(OBJTREE)/include/config.mk,$(wildcard $(OBJTREE)/include/config.mk))

 

# load ARCH, BOARD, and CPU configuration

#开头一句中的include,它是把后面跟的文件内容给加到它出现的地方,这里就是把#$(OBJTREE)/include/config.mk文件的内容加入到了这里,所以就得到了ARCH,BOARD与CPU

#的值,如果VENDOR与SOC也定义了,也会得到它们的值。

include $(OBJTREE)/include/config.mk

export    ARCH CPU BOARD VENDOR SOC

 

#接着的一大段,就是在判断没有定义CROSS_COMPILE变量的情况下,根据各种情况对这个变量的值进行判断。这个值就是交叉编译工具的开头部分的名称。建议在编译的时候,还是把这个变量的值给置上,置上当前系统里交叉编译工具相应的值,因为很难指望这些个判断就能把你现在系统里的值给判断对了。置变量的方法有-很多,其中一个,就是在make命令后跟上变量的赋值,例如:make CROSS_COMPILE=arm-linux-gnueabi-,或是把CROSS_COMPILE设成一个系统变量,然后直接make CROSS_COMPILE=${CROSS_COMPILE}-这样来设置。

ifndef CROSS_COMPILE

ifeq ($(HOSTARCH),ppc)

CROSS_COMPILE =

else

ifeq ($(ARCH),ppc)

CROSS_COMPILE = powerpc-linux-

endif

ifeq ($(ARCH),arm)

CROSS_COMPILE = arm-linux-

endif

ifeq ($(ARCH),i386)

ifeq ($(HOSTARCH),i386)

CROSS_COMPILE =

else

CROSS_COMPILE = i386-linux-

endif

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-elf-

endif

endif

endif

 

export    CROSS_COMPILE

 

# load other configuration

#这里把$(TOPDIR)/config.mk这个文件的内容包含进来了,即包含顶层目录下的config.mk,

#这个文件里面主要定义了交叉编译器及选项和编译规则(sinclude,它也是把后面所跟的文件给包含进来。它与include的区别就是,include后面跟的文件,一定是存在的,如果不存在,执行就会出错误;那么sinclude后面所跟的文件,可以不存在,如果文件存在则包含进来,如果不存在,则什么也不做。)

include $(TOPDIR)/config.mk

 

#########################################################################

# U-Boot objects....order is important (i.e. start must be first)

 

#U-boot需要的目标文件,顺序很重要,start.o必须放第一位,

#针对不同架构,安排目标文件的布局,对于不同的CPU追加相应的目标文件。这段代码,其#实也是定义变量,根据不同的条件,给变量定义不同的值。这些变量都是在后面编译的时

#候,写到运行命令参数里面的,这些变量的意义,还有各种参数的意义,可以查看相应的

#工具的参数手册来得到,跟移植没有什么太大的关系

#需要注意一下各个变量值所添加的顺序,第一个添加的,编译的时候,变量进行替换,就

#会被放在前面,然后就会被首先编译,连接,以此类推。可以看到,最先执行的就是start.o

#这个文件里的内容,这个文件是由start.S来生成的

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),mpc83xx)

OBJS += cpu/$(CPU)/resetvec.o

endif

ifeq ($(CPU),mpc85xx)

OBJS += cpu/$(CPU)/resetvec.o

endif

ifeq ($(CPU),bf533)

OBJS += cpu/$(CPU)/start1.o  cpu/$(CPU)/interrupt.o       cpu/$(CPU)/cache.o

OBJS += cpu/$(CPU)/cplbhdlr.o     cpu/$(CPU)/cplbmgr.o       cpu/$(CPU)/flush.o

endif

 

OBJS := $(addprefix $(obj),$(OBJS))

 

#需要的库文件

LIBS  = lib_generic/libgeneric.a

LIBS += board/$(BOARDDIR)/lib$(BOARD).a

LIBS += cpu/$(CPU)/lib$(CPU).a

ifdef SOC

LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).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

LIBS += net/libnet.a

LIBS += disk/libdisk.a

LIBS += rtc/librtc.a

LIBS += dtt/libdtt.a

LIBS += drivers/libdrivers.a

LIBS += drivers/nand/libnand.a

LIBS += drivers/nand_legacy/libnand_legacy.a

LIBS += drivers/sk98lin/libsk98lin.a

LIBS += post/libpost.a post/cpu/libcpu.a

LIBS += common/libcommon.a

LIBS += $(BOARDLIBS)

 

LIBS := $(addprefix $(obj),$(LIBS))

.PHONY : $(LIBS)

 

# 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 /

         post /

         post/cpu

.PHONY : $(SUBDIRS)

 

ifeq ($(CONFIG_NAND_U_BOOT),y)

NAND_SPL = nand_spl

U_BOOT_NAND = $(obj)u-boot-nand.bin

endif

 

__OBJS := $(subst $(obj),,$(OBJS))

__LIBS := $(subst $(obj),,$(LIBS))

 

#########################################################################

#########################################################################

 

#这里就是定义了各种目标的target。我们最终想要的目标就是$(obj)u-boot,然后看后面的,#它都信赖了好多其它的目标,然后这些个目标,也是在此处定义的,然后有相应的$(MAKE)

#来执行相应的操作,所以这样就实现了一个Makefile文件,

#套很多个其它的Makefile文件来编译整个工程的情况。

ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)

 

all:          $(ALL)

 

$(obj)u-boot.hex: $(obj)u-boot

              $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@

 

$(obj)u-boot.srec:       $(obj)u-boot

              $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@

 

$(obj)u-boot.bin:  $(obj)u-boot

              $(OBJCOPY) ${OBJCFLAGS} -O 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.dis:  $(obj)u-boot

              $(OBJDUMP) -d $< > $@

 

$(obj)u-boot:        depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)

              UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*/(__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):

              $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))

 

$(LIBS):

              $(MAKE) -C $(dir $(subst $(obj),,$@))

 

$(SUBDIRS):

              $(MAKE) -C $@ all

 

$(NAND_SPL):   version

              $(MAKE) -C nand_spl all

 

$(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin

              cat nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin

 

version:

              @echo -n "#define U_BOOT_VERSION /"U-Boot " > $(VERSION_FILE); /

              echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); /

              echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion /

                      $(TOPDIR)) >> $(VERSION_FILE); /

              echo "/"" >> $(VERSION_FILE)

 

gdbtools:

              $(MAKE) -C tools/gdb all || exit 1

 

updater:

              $(MAKE) -C tools/updater all || exit 1

 

env:

              $(MAKE) -C tools/env all || exit 1

 

depend dep:

              for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done

 

tags ctags:

              ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include /

                            lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) /

                            fs/cramfs fs/fat fs/fdos fs/jffs2 /

                            net disk rtc dtt drivers drivers/sk98lin common /

                     /( -name CVS -prune /) -o /( -name '*.[ch]' -print /)`

 

etags:

              etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include /

                            lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) /

                            fs/cramfs fs/fat fs/fdos fs/jffs2 /

                            net disk rtc dtt drivers drivers/sk98lin common /

                     /( -name CVS -prune /) -o /( -name '*.[ch]' -print /)`

 

$(obj)System.map:      $(obj)u-boot

              @$(NM) $< | /

              grep -v '/(compiled/)/|/(/.o$$/)/|/( [aUw] /)/|/(/./.ng$$/)/|/(LASH[RL]DI/)' | /

              sort > $(obj)System.map

 

#########################################################################

else

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) version gdbtools updater env depend /

dep tags ctags etags $(obj)System.map:

       @echo "System not configured - see README" >&2

       @ exit 1

endif

#这里就明说了,如果$(OBJTREE)/include/config.mk文件不存在,则编译不能进行下去了。

#########################################################################

 

#删掉了包括$(obj)include/config.mk文件在内的,几个在编译的时候生成的配置文件,这

#个$(obj)include/config.mk与$(OBJTREE)/include/config.mk是同一个文件。这样做是为

#了保证重新生成文件的纯粹性。

unconfig:

       @rm -f $(obj)include/config.h $(obj)include/config.mk /

              $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp

 

#========================================================================

# PowerPC

#========================================================================

 

#########################################################################

## MPC5xx Systems

#########################################################################

 

canmb_config:      unconfig

       @$(MKCONFIG) -a canmb ppc mpc5xxx canmb

 

cmi_mpc5xx_config:    unconfig

       @$(MKCONFIG) $(@:_config=) ppc mpc5xx cmi

 

PATI_config:        unconfig

       @$(MKCONFIG) $(@:_config=) ppc mpc5xx pati mpl

 

#########################################################################

## MPC5xxx Systems

#########################################################################

 

aev_config: unconfig

       @$(MKCONFIG) -a aev ppc mpc5xxx tqm5200

 

BC3450_config:   unconfig

       @$(MKCONFIG) -a BC3450 ppc mpc5xxx bc3450

 

cpci5200_config:  unconfig

       @$(MKCONFIG) -a cpci5200  ppc mpc5xxx cpci5200 esd

 

hmi1001_config:         unconfig

       @$(MKCONFIG) hmi1001 ppc mpc5xxx hmi1001

 

Lite5200_config                        /

Lite5200_LOWBOOT_config                 /

Lite5200_LOWBOOT08_config             /

icecube_5200_config                 /

icecube_5200_LOWBOOT_config         /

icecube_5200_LOWBOOT08_config            /

icecube_5200_DDR_config             /

icecube_5200_DDR_LOWBOOT_config     /

icecube_5200_DDR_LOWBOOT08_config  /

icecube_5100_config:                unconfig

       @mkdir -p $(obj)include

       @mkdir -p $(obj)board/icecube

       @ >$(obj)include/config.h

       @[ -z "$(findstring LOWBOOT_,$@)" ] || /

              { if [ "$(findstring DDR,$@)" ] ; /

                     then echo "TEXT_BASE = 0xFF800000" >$(obj)board/icecube/config.tmp ; /

                     else echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; /

                fi ; /

                echo "... with LOWBOOT configuration" ; /

              }

       @[ -z "$(findstring LOWBOOT08,$@)" ] || /

              { echo "TEXT_BASE = 0xFF800000" >$(obj)board/icecube/config.tmp ; /

                echo "... with 8 MB flash only" ; /

                echo "... with LOWBOOT configuration" ; /

              }

       @[ -z "$(findstring DDR,$@)" ] || /

              { echo "#define CONFIG_MPC5200_DDR" >>$(obj)include/config.h ; /

                echo "... DDR memory revision" ; /

              }

       @[ -z "$(findstring 5200,$@)" ] || /

              { echo "#define CONFIG_MPC5200"           >>$(obj)include/config.h ; /

                echo "... with MPC5200 processor" ; /

              }

       @[ -z "$(findstring 5100,$@)" ] || /

              { echo "#define CONFIG_MGT5100"           >>$(obj)include/config.h ; /

                echo "... with MGT5100 processor" ; /

              }

       @$(MKCONFIG) -a IceCube ppc mpc5xxx icecube

 

v38b_config: unconfig

       @./mkconfig -a V38B ppc mpc5xxx v38b

 

inka4x0_config:    unconfig

       @$(MKCONFIG) inka4x0 ppc mpc5xxx inka4x0

 

lite5200b_config   /

lite5200b_LOWBOOT_config: unconfig

       @mkdir -p $(obj)include

       @mkdir -p $(obj)board/icecube

       @ >$(obj)include/config.h

       @ echo "#define CONFIG_MPC5200_DDR"      >>$(obj)include/config.h

       @ echo "... DDR memory revision"

       @ echo "#define CONFIG_MPC5200"         >>$(obj)include/config.h

       @ echo "#define CONFIG_LITE5200B"       >>$(obj)include/config.h

       @[ -z "$(findstring LOWBOOT_,$@)" ] || /

              { echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; /

                echo "... with LOWBOOT configuration" ; /

              }

       @ echo "... with MPC5200B processor"

       @$(MKCONFIG) -a IceCube  ppc mpc5xxx icecube

 

mcc200_config     /

mcc200_SDRAM_config   /

mcc200_highboot_config    /

mcc200_COM12_config    /

mcc200_COM12_SDRAM_config  /

mcc200_COM12_highboot_config   /

mcc200_COM12_highboot_SDRAM_config /

mcc200_highboot_SDRAM_config  /

prs200_config      /

prs200_DDR_config   /

prs200_highboot_config     /

prs200_highboot_DDR_config:  unconfig

       @mkdir -p $(obj)include

       @mkdir -p $(obj)board/mcc200

       @ >$(obj)include/config.h

       @[ -n "$(findstring highboot,$@)" ] || /

              { echo "... with lowboot configuration" ; /

              }

       @[ -z "$(findstring highboot,$@)" ] || /

              { echo "TEXT_BASE = 0xFFF00000" >$(obj)board/mcc200/config.tmp ; /

                echo "... with highboot configuration" ; /

              }

       @[ -n "$(findstring _SDRAM,$@)" ] || /

              { if [ -n "$(findstring mcc200,$@)" ]; /

                then /

                   echo "... with DDR" ; /

                else /

                     if [ -n "$(findstring _DDR,$@)" ];/

                     then /

                            echo "... with DDR" ; /

                     else /

                            echo "#define CONFIG_MCC200_SDRAM" >>$(obj)include/config.h ;/

                            echo "... with SDRAM" ; /

                     fi; /

                fi; /

              }

       @[ -z "$(findstring _SDRAM,$@)" ] || /

              { echo "#define CONFIG_MCC200_SDRAM"    >>$(obj)include/config.h ; /

                echo "... with SDRAM" ; /

              }

       @[ -z "$(findstring COM12,$@)" ] || /

              { echo "#define CONFIG_CONSOLE_COM12" >>$(obj)include/config.h ; /

                echo "... with console on COM12" ; /

              }

       @[ -z "$(findstring prs200,$@)" ] || /

              { echo "#define CONFIG_PRS200"  >>$(obj)include/config.h ;/

              }

       @$(MKCONFIG) -n $@ -a mcc200 ppc mpc5xxx mcc200

 

o2dnt_config:

       @$(MKCONFIG) o2dnt ppc mpc5xxx o2dnt

 

pf5200_config:  unconfig

       @$(MKCONFIG) pf5200  ppc mpc5xxx pf5200 esd

 

PM520_config /

PM520_DDR_config /

PM520_ROMBOOT_config /

PM520_ROMBOOT_DDR_config: unconfig

       @mkdir -p $(obj)include

       @ >$(obj)include/config.h

       @[ -z "$(findstring DDR,$@)" ] || /

              { echo "#define CONFIG_MPC5200_DDR" >>$(obj)include/config.h ; /

                echo "... DDR memory revision" ; /

              }

       @[ -z "$(findstring ROMBOOT,$@)" ] || /

              { echo "#define CONFIG_BOOT_ROM" >>$(obj)include/config.h ; /

                echo "... booting from 8-bit flash" ; /

              }

       @$(MKCONFIG) -a PM520 ppc mpc5xxx pm520

 

smmaco4_config: unconfig

       @$(MKCONFIG) -a smmaco4 ppc mpc5xxx tqm5200

 

spieval_config:      unconfig

       @$(MKCONFIG) -a spieval ppc mpc5xxx tqm5200

 

TB5200_B_config /

TB5200_config:    unconfig

       @mkdir -p $(obj)include

       @[ -z "$(findstring _B,$@)" ] || /

              { echo "#define CONFIG_TQM5200_B"      >>$(obj)include/config.h ; /

                echo "... with MPC5200B processor" ; /

              }

       @$(MKCONFIG) -n $@ -a TB5200 ppc mpc5xxx tqm5200

 

MINI5200_config       /

EVAL5200_config      /

TOP5200_config: unconfig

       @mkdir -p $(obj)include

       @ echo "#define CONFIG_$(@:_config=) 1"       >$(obj)include/config.h

       @$(MKCONFIG) -n $@ -a TOP5200 ppc mpc5xxx top5200 emk

 

Total5100_config        /

Total5200_config        /

Total5200_lowboot_config /

Total5200_Rev2_config            /

Total5200_Rev2_lowboot_config:    unconfig

       @mkdir -p $(obj)include

       @mkdir -p $(obj)board/total5200

       @ >$(obj)include/config.h

       @[ -z "$(findstring 5100,$@)" ] || /

              { echo "#define CONFIG_MGT5100"           >>$(obj)include/config.h ; /

                echo "... with MGT5100 processor" ; /

              }

       @[ -z "$(findstring 5200,$@)" ] || /

              { echo "#define CONFIG_MPC5200"           >>$(obj)include/config.h ; /

                echo "... with MPC5200 processor" ; /

              }

       @[ -n "$(findstring Rev,$@)" ] || /

              { echo "#define CONFIG_TOTAL5200_REV 1"  >>$(obj)include/config.h ; /

                echo "... revision 1 board" ; /

              }

       @[ -z "$(findstring Rev2_,$@)" ] || /

              { echo "#define CONFIG_TOTAL5200_REV 2"  >>$(obj)include/config.h ; /

                echo "... revision 2 board" ; /

              }

       @[ -z "$(findstring lowboot_,$@)" ] || /

              { echo "TEXT_BASE = 0xFE000000" >$(obj)board/total5200/config.tmp ; /

                echo "... with lowboot configuration" ; /

              }

       @$(MKCONFIG) -a Total5200 ppc mpc5xxx total5200

 

cam5200_config /

fo300_config /

MiniFAP_config /

TQM5200S_config /

TQM5200S_HIGHBOOT_config /

TQM5200_B_config /

TQM5200_B_HIGHBOOT_config /

TQM5200_config       /

TQM5200_STK100_config:     unconfig

       @mkdir -p $(obj)include

       @mkdir -p $(obj)board/tqm5200

       @ >$(obj)include/config.h

       @[ -z "$(findstring cam5200,$@)" ] || /

              { echo "#define CONFIG_CAM5200"    >>$(obj)include/config.h ; /

                echo "#define CONFIG_TQM5200S"       >>$(obj)include/config.h ; /

                echo "#define CONFIG_TQM5200_B"     >>$(obj)include/config.h ; /

                echo "... TQM5200S on Cam5200" ; /

              }

       @[ -z "$(findstring fo300,$@)" ] || /

              { echo "#define CONFIG_FO300"  >>$(obj)include/config.h ; /

                echo "... TQM5200 on FO300" ; /

              }

       @[ -z "$(findstring MiniFAP,$@)" ] || /

              { echo "#define CONFIG_MINIFAP"    >>$(obj)include/config.h ; /

                echo "... TQM5200_AC on MiniFAP" ; /

              }

       @[ -z "$(findstring STK100,$@)" ] || /

              { echo "#define CONFIG_STK52XX_REV100"  >>$(obj)include/config.h ; /

                echo "... on a STK52XX.100 base board" ; /

              }

       @[ -z "$(findstring TQM5200_B,$@)" ] || /

              { echo "#define CONFIG_TQM5200_B"      >>$(obj)include/config.h ; /

              }

       @[ -z "$(findstring TQM5200S,$@)" ] || /

              { echo "#define CONFIG_TQM5200S"  >>$(obj)include/config.h ; /

                echo "#define CONFIG_TQM5200_B"     >>$(obj)include/config.h ; /

              }

       @[ -z "$(findstring HIGHBOOT,$@)" ] || /

              { echo "TEXT_BASE = 0xFFF00000" >$(obj)board/tqm5200/config.tmp ; /

              }

       @$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200

 

#########################################################################

#########################################################################

#########################################################################

 

clean:

       find $(OBJTREE) -type f /

              /( -name 'core' -o -name '*.bak' -o -name '*~' /

              -o -name '*.o'  -o -name '*.a'  /) -print /

              | xargs rm -f

       rm -f $(obj)examples/hello_world $(obj)examples/timer /

             $(obj)examples/eepro100_eeprom $(obj)examples/sched /

             $(obj)examples/mem_to_mem_idma2intr $(obj)examples/82559_eeprom /

             $(obj)examples/smc91111_eeprom $(obj)examples/interrupt /

             $(obj)examples/test_burst

       rm -f $(obj)tools/img2srec $(obj)tools/mkimage $(obj)tools/envcrc /

              $(obj)tools/gen_eth_addr

       rm -f $(obj)tools/mpc86x_clk $(obj)tools/ncb

       rm -f $(obj)tools/easylogo/easylogo $(obj)tools/bmp_logo

       rm -f $(obj)tools/gdb/astest $(obj)tools/gdb/gdbcont $(obj)tools/gdb/gdbsend

       rm -f $(obj)tools/env/fw_printenv $(obj)tools/env/fw_setenv

       rm -f $(obj)board/cray/L1/bootscript.c $(obj)board/cray/L1/bootscript.image

       rm -f $(obj)board/netstar/eeprom $(obj)board/netstar/crcek $(obj)board/netstar/crcit

       rm -f $(obj)board/netstar/*.srec $(obj)board/netstar/*.bin

       rm -f $(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom

       rm -f $(obj)board/integratorap/u-boot.lds $(obj)board/integratorcp/u-boot.lds

       rm -f $(obj)include/bmp_logo.h

       find nand_spl -lname "*" -print | xargs rm -f

       rm -f nand_spl/u-boot-spl nand_spl/u-boot-spl.map

 

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)include/version_autogenerated.h

       rm -fr $(obj)*.*~

       rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)

       rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c

       rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c

       rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm

 

ifeq ($(OBJTREE),$(SRCTREE))

mrproper /

distclean:       clobber unconfig

else

mrproper /

distclean:       clobber unconfig

       rm -rf $(OBJTREE)/*

endif

 

backup:

       F=`basename $(TOPDIR)` ; cd .. ; /

       gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F

 

#########################################################################

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/chongchongliu/archive/2008/11/03/3207362.aspx

原创粉丝点击