]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - Makefile
Merge branch 'master' of git://git.denx.de/u-boot-ppc4xx
[karo-tx-uboot.git] / Makefile
index b1e07a7b331256ba5375752d72fdf5aa1cb7c255..e081c25cf4057086d27f5f7c9c500287fc479d88 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -104,10 +104,11 @@ $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
 endif # ifneq ($(BUILD_DIR),)
 
 OBJTREE                := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
+SPLTREE                := $(OBJTREE)/spl
 SRCTREE                := $(CURDIR)
 TOPDIR         := $(SRCTREE)
 LNDIR          := $(OBJTREE)
-export TOPDIR SRCTREE OBJTREE
+export TOPDIR SRCTREE OBJTREE SPLTREE
 
 MKCONFIG       := $(SRCTREE)/mkconfig
 export MKCONFIG
@@ -341,22 +342,15 @@ BOARD_SIZE_CHECK =
 endif
 
 # Always append ALL so that arch config.mk's can add custom ones
-ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
+ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 
-ifeq ($(CONFIG_NAND_U_BOOT),y)
-ALL += $(obj)u-boot-nand.bin
-endif
-
-ifeq ($(CONFIG_ONENAND_U_BOOT),y)
-ALL += $(obj)u-boot-onenand.bin
+ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
+ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
-endif
+ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin
+ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
 
-ifeq ($(CONFIG_MMC_U_BOOT),y)
-ALL += $(obj)mmc_spl/u-boot-mmc-spl.bin
-endif
-
-all:           $(ALL)
+all:           $(ALL-y)
 
 $(obj)u-boot.hex:      $(obj)u-boot
                $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
@@ -381,7 +375,7 @@ $(obj)u-boot.ldr.srec:      $(obj)u-boot.ldr
 
 $(obj)u-boot.img:      $(obj)u-boot.bin
                $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
-               -a $(CONFIG_SYS_TEXT_BASE) -e 0 \
+               -O u-boot -a $(CONFIG_SYS_TEXT_BASE) -e 0 \
                -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
                        sed -e 's/"[     ]*$$/ for $(BOARD) board"/') \
                -d $< $@
@@ -400,6 +394,10 @@ $(obj)u-boot.sha1: $(obj)u-boot.bin
 $(obj)u-boot.dis:      $(obj)u-boot
                $(OBJDUMP) -d $< > $@
 
+$(obj)u-boot.ubl:       $(obj)u-boot-nand.bin
+               $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
+               -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
+
 GEN_UBOOT = \
                UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
                sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
@@ -452,6 +450,9 @@ mmc_spl:    $(TIMESTAMP_FILE) $(VERSION_FILE) depend
 
 $(obj)mmc_spl/u-boot-mmc-spl.bin:      mmc_spl
 
+$(obj)spl/u-boot-spl.bin:              depend
+               $(MAKE) -C spl all
+
 $(TIMESTAMP_FILE):
                @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
                @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@
@@ -471,15 +472,19 @@ TAG_SUBDIRS = $(SUBDIRS)
 TAG_SUBDIRS += $(dir $(__LIBS))
 TAG_SUBDIRS += include
 
+FIND := find
+FINDFLAGS := -L
+
 tags ctags:
-               ctags -w -o $(obj)ctags `find $(TAG_SUBDIRS) \
+               ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
                                                -name '*.[chS]' -print`
 
 etags:
-               etags -a -o $(obj)etags `find $(TAG_SUBDIRS) \
+               etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
                                                -name '*.[chS]' -print`
 cscope:
-               find $(TAG_SUBDIRS) -name '*.[chS]' -print > cscope.files
+               $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
+                                               cscope.files
                cscope -b -q -k
 
 SYSTEM_MAP = \
@@ -536,6 +541,7 @@ tools: $(VERSION_FILE)
 endif  # config.mk
 
 $(VERSION_FILE):
+               @mkdir -p $(dir $(VERSION_FILE))
                @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
                   printf '#define PLAIN_VERSION "%s%s"\n' \
                        "$(U_BOOT_VERSION)" "$${localvers}" ; \
@@ -1084,6 +1090,7 @@ clean:
        @rm -f $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin}
        @rm -f $(ONENAND_BIN)
        @rm -f $(obj)onenand_ipl/u-boot.lds
+       @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.lds,u-boot-spl.map}
        @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
        @find $(OBJTREE) -type f \
                \( -name 'core' -o -name '*.bak' -o -name '*~' \
@@ -1097,9 +1104,10 @@ clobber: clean
                | 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)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
        @rm -f $(obj)u-boot.kwb
        @rm -f $(obj)u-boot.imx
+       @rm -f $(obj)u-boot.ubl
        @rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}
        @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
        @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
@@ -1108,12 +1116,9 @@ clobber: clean
        @[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
        @[ ! -d $(obj)mmc_spl ] || find $(obj)mmc_spl -name "*" -type l -print | xargs rm -f
 
-ifeq ($(OBJTREE),$(SRCTREE))
-mrproper \
-distclean:     clobber unconfig
-else
 mrproper \
 distclean:     clobber unconfig
+ifneq ($(OBJTREE),$(SRCTREE))
        rm -rf $(obj)*
 endif