uboot之makefile源码

来源:互联网 发布:斗鱼皇帝 知乎 编辑:程序博客网 时间:2024/04/28 15:09

被export声明的变量有:HOSTARCH HOSTOS TOPDIR SRCTREE OBJTREE REMOTE_BUILD obj src CROSS_COMPILE。

总结:花了一个多的星期,整篇makefile应该算看懂了。也学到了很多,比如一些基本的shell脚本命令。当然还有make的用法啦。

另外源码目录下的mkconfig与config.mk也应该要了解。这三个文件都是互相联系的。接下来的任务就是将这两个脚本再了解一下,理清思路。最后的任务就是大致了解uboot源码的启动流程了。从网上得知,貌似是start.s与 arm_boot.c一同完成bootloader启动的两个阶段任务。加油吧。

 

 

#

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

#

 

VERSION = 1

PATCHLEVEL = 1

SUBLEVEL = 6

EXTRAVERSION =

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

VERSION_FILE = $(obj)include/version_autogenerated.h //此时的$(obj)在后面才定义,VERSION-FILE在后面会被引用到~~

 

HOSTARCH := $(shell uname -m | \  //比如说,你的host可能是i486--debian系统,i586gentoo系统, i686-ubuntu系统。sed命令是用来做一些替换的

       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/)     //执行shell脚本命令,HOSTARCHHOSTOS作用??

 

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

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

 

export    HOSTARCH HOSTOS  //然后再引入这两个变量,靠顶层Makefile传递下去

 

# Deal with colliding definitions from tcsh etc.

VENDOR=

 

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

#

# U-boot build supports producing a object files to the separate external

# directory. Two use cases are supported:

#Uboot支持将目标文件生成在外部的文件夹中,有两种命令可以实现。其实我们可以假设没有重新定义输出目录,这样理解起来会更加容易一些。

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

#引入环境变量BUILD_DIR

# 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.  //如果没有重新定义目标文件输出目录,那么它将会被存放在源码目录下~

#

// 'make O=/tmp/build all' 即这个命令,O代表目录吧~如果O不为0,并判断ifeq是否成立

ifdef O

ifeq ("$(origin O)", "command line")   //origin函数不像其它的函数,他并不操作变量的值,他只是告诉你你的这个变量是哪里来的?其语法是:

$(origin <variable>) 注意,<variable>是变量的名字,不应该是引用。所以你最好不要在<variable>中使用“$”字符。Origin函数会以其返回值来告诉你这个变量的出生情况,下面,是origin函数的返回值“undefined”如果<variable>从来没有定义过,origin函数返回这个值“undefined”

 

  

endif

endif

//再判断BUILD_DIR是否为0,若不为0ifneq为真,则save-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}]表示这个build_dir是不是一个目录 ,如果没有就创建, [ ] 就是个条件判断语句了

 

# Verify if it was successful.确定是否成功

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

//shell中命令的意思是先打开这个目录,再调用Pwd显示当前路径,在将这个路径值赋给BUILD_DIR

 

$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) //if条件判断语句~如果BUILD_DIR还不存在的话,则输出XXXdoes not exist

endif # ifneq ($(BUILD_DIR),)

 

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

SRCTREE            := $(CURDIR)

TOPDIR        := $(SRCTREE)  //如果没有定义BUILD_DIR,一切是不是变的很简单^o^

LNDIR           := $(OBJTREE)

export    TOPDIR SRCTREE OBJTREE

 

MKCONFIG   := $(SRCTREE)/mkconfig //定义变量MKCONFIG,这个变量值为源码目录下的mkconfig脚本。

export MKCONFIG //然后再声明

 

ifneq ($(OBJTREE),$(SRCTREE))

REMOTE_BUILD        := 1  //如果输出目录与源码目录不等,则标志REMOTE_BUILD

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.

// 如果OBJTREE即输出目录,与SRCTREE即当前的Uboot目录不等的话,ifneq成立,在对obj,src进行赋值~~~,如果相等,则obj,src为空。

ifneq ($(OBJTREE),$(SRCTREE)) //ifneq 是两者不相等的时候为真

obj := $(OBJTREE)/

src := $(SRCTREE)/

else

obj :=

src :=

endif

export obj src

 

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

 

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

//wildcard的意思是要宏变量展开,不太懂这句有什么意义~

# load ARCH, BOARD, and CPU configuration

include $(OBJTREE)/include/config.mk   //这个config.mkmkconfig脚本生成的,其中只包含下面几个变量。

export    ARCH CPU BOARD VENDOR SOC //config.mk中的内容 ,这几个参数是smdk2410_config:后面输入的

 

ifndef CROSS_COMPILE //ifndef,若CROSS_COMPILE为空,为真,如果CROSS_COMPILE已经被定义,则跳过这个判断~ifdef刚好相反

ifeq ($(HOSTARCH),ppc)  //判断呢~这个还是很好懂的

CROSS_COMPILE =

else

ifeq ($(ARCH),ppc)

CROSS_COMPILE = powerpc-linux-

endif

ifeq ($(ARCH),arm) //如果ARCH返回值等于arm,则交叉编译器为arm-linux-

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

ifeq ($(ARCH),avr32)

CROSS_COMPILE = avr32-

endif

endif

endif //最后这个endif infdef配对

 

export    CROSS_COMPILE  //声明交叉编译器的类型

 

# load other configuration

include $(TOPDIR)/config.mk //TOPDIR就是Uboot的主目录,引入顶层config.mk文件,这个文件主要是完成一些配置。

 

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

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

目标对象,顺序很重要,比如start必须是第一个~start.o启动文件

OBJS  = cpu/$(CPU)/start.o //定义变量OBJS

ifeq ($(CPU),i386)

OBJS += cpu/$(CPU)/start16.o //如果是i386类型的,则向OBJS追加一个start16.o文件,即再cpu/$(CPU)/目录添加start16.o文件~下面意思都差不多呢,有点奇怪,在下面例如ifeq ($(CPU),i386)这种类型的判断,怎么没有ifeq ($(CPU),arm)??对了,$CPU是参数,这几个参数是自己定义的吗??后来我才明白过来,从smdk2410_config 后面输入的参数可以看出,$(CPU)等等,就是相当于默认就是arm了。多看几遍才行

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

endif

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

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)) //addprefix是增加前缀的函数,将$(obj)加到$(OBJS)前,最后返回带前缀的$(OBJS)

 

LIBS  = lib_generic/libgeneric.a  库函数

LIBS += board/$(BOARDDIR)/lib$(BOARD).a //增加LIBS需要的库文件,这个库文件在哪里生成的呢~这几个库文件是由board/$(BOARDDIR)/目录下的Makefile生成的~

LIBS += cpu/$(CPU)/lib$(CPU).a //同样的道理

ifdef SOC //SOCmkconfig返回的s3c24x0,这句话判断SOC是否为0

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) //BOARDLIBS在哪里定义了

 

LIBS := $(addprefix $(obj),$(LIBS)) //在这些文件前面添加空格?

.PHONY : $(LIBS)

 

# Add GCC lib  //添加GCC的库文件

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)) //subst字符串替换函数,把$(OBJS)中的$(obj)字符替换成空格。。但是OBJS中的obj已经是空格了。

__LIBS := $(subst $(obj),,$(LIBS)) /这个也是,libs中的obj已经是空格了

 

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

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

 

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

//U_BOOT_NAND在前面定义了,为u-boot-nand.bin

all:          $(ALL) //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 $< > $@

//这里是uboot的镜像生成。

$(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 //回到源码目录,用ld链接start.o,同时与LIBSPLATFORM_LIBS中定义的库文件,以及Uboot.map共同生成u-boot。这样理解应该是对的

 

$(OBJS): // cpu/arm920t/start.o ,执行/cpu/arm920t目录下的makefile

              $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@)) //执行非目录部分,而可被make执行的只有makefile,我是这么理解的

 

$(LIBS):

              $(MAKE) -C $(dir $(subst $(obj),,$@)) //dir 表示去目录部分,打开所有的目录

 

$(SUBDIRS):

              $(MAKE) -C $@ all //执行subdir变量所有的makefile

 

$(NAND_SPL):     version

              $(MAKE) -C nand_spl/board/$(BOARDDIR) all //NAND_SPL依赖于version

 

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

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

 

version:  //$(VERSION-FILE)又在哪定义了

              @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

 

.PHONY : CHANGELOG

CHANGELOG:

       git log --no-merges U-Boot-1_1_5.. | \

       unexpand -a | sed -e 's/\s\s*$$//' > $@

 

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

 

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  //表示Lite5200**ice***都依赖于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 //上面这部分与arm无关,也懒的看了。道理都是一样的

 

v38b_config: unconfig

       @./mkconfig -a V38B ppc mpc5xxx v38b

 

inka4x0_config:    unconfig

       @$(MKCONFIG) inka4x0 ppc mpc5xxx inka4x0

 

 

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 //翻了几十页,总算翻到这里了!!!原来ubootmakefile并不难,之所以源码文件这么大,是因为它所支持的开发板很多很多,从上面翻到这里,足足有一百多种了吧,而且后面还有那么多~囧!!这个smdk2410_config 才是我们真是有用的。将makefile翻一遍,才真正体验到了uboot的强大!!!- -#

       @$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0

 

SX1_config :        unconfig

       @$(MKCONFIG) $(@:_config=) arm arm925t sx1

 

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

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

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

 

clean:    //什么config终于完了,Makefile也结束了~~~最后剩下这几个老弱残兵,只是一些命令罢了

       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

       rm -f $(obj)nand_spl/u-boot-spl $(obj)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

       [ ! -d $(OBJTREE)/nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f

 

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

 

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

0 0
原创粉丝点击