]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - Makefile
board: bcm28155_ap: Add board files
[karo-tx-uboot.git] / Makefile
index ec5881bffcc445e9cbd61836762b2bd9de02e8ef..9a530b3e80a0295f18cab2ecde638a0facde84a3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,9 @@
 #
 
 VERSION = 2014
-PATCHLEVEL = 01
+PATCHLEVEL = 04
 SUBLEVEL =
-EXTRAVERSION =
+EXTRAVERSION = -rc1
 NAME =
 
 # *DOCUMENTATION*
@@ -392,6 +392,17 @@ scripts_basic:
 # To avoid any implicit rule to kick in, define an empty command.
 scripts/basic/%: scripts_basic ;
 
+PHONY += outputmakefile
+# outputmakefile generates a Makefile in the output directory, if using a
+# separate output directory. This allows convenient use of make in the
+# output directory.
+outputmakefile:
+ifneq ($(KBUILD_SRC),)
+       $(Q)ln -fsn $(srctree) source
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
+           $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+endif
+
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to scripts/kconfig/Makefile
 # It is allowed to specify more targets when calling make, including
@@ -428,8 +439,16 @@ ifeq ($(mixed-targets),1)
 # We're called with mixed targets (*config and build targets).
 # Handle them one by one.
 
-%:: FORCE
-       $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
+PHONY += $(MAKECMDGOALS) build-one-by-one
+
+$(MAKECMDGOALS): build-one-by-one
+       @:
+
+build-one-by-one:
+       $(Q)set -e; \
+       for i in $(MAKECMDGOALS); do \
+               $(MAKE) -f $(srctree)/Makefile $$i; \
+       done
 
 else
 ifeq ($(config-targets),1)
@@ -441,7 +460,7 @@ ifeq ($(config-targets),1)
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
 
-%_config::
+%_config:: outputmakefile
        @$(MKCONFIG) -A $(@:_config=)
 
 else
@@ -578,7 +597,6 @@ libs-y += $(CPUDIR)/
 ifdef SOC
 libs-y += $(CPUDIR)/$(SOC)/
 endif
-libs-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
 libs-$(CONFIG_OF_EMBED) += dts/
 libs-y += arch/$(ARCH)/lib/
 libs-y += fs/
@@ -701,7 +719,7 @@ ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
 ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
 ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
 ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
-ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
+ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
 endif
@@ -725,11 +743,11 @@ endif
 
 all:           $(ALL-y)
 
-u-boot.dtb:    checkdtc u-boot
-               $(MAKE) $(build)=dts binary
-               mv dts/dt.dtb $@
+PHONY += dtbs
+dtbs dts/dt.dtb: checkdtc u-boot
+       $(Q)$(MAKE) $(build)=dts dtbs
 
-u-boot-dtb.bin:        u-boot.bin u-boot.dtb
+u-boot-dtb.bin: u-boot.bin dts/dt.dtb
                cat $^ >$@
 
 u-boot.hex:    u-boot
@@ -856,8 +874,8 @@ u-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin
                rm spl/u-boot-spl-pad.bin
 
 ifeq ($(CONFIG_OF_SEPARATE),y)
-u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin u-boot.dtb
-               cat u-boot-nodtb-tegra.bin u-boot.dtb > $@
+u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb
+               cat $^ > $@
 endif
 endif
 
@@ -920,7 +938,7 @@ $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ;
 # Error messages still appears in the original language
 
 PHONY += $(u-boot-dirs)
-$(u-boot-dirs): depend scripts_basic
+$(u-boot-dirs): depend prepare scripts
        $(Q)$(MAKE) $(build)=$@
 
 tools: $(TIMESTAMP_FILE) $(VERSION_FILE)
@@ -930,6 +948,41 @@ $(filter-out tools, $(u-boot-dirs)): tools
 # is "yes"), so compile examples after U-Boot is compiled.
 examples: $(filter-out examples, $(u-boot-dirs))
 
+# Things we need to do before we recursively start building the kernel
+# or the modules are listed in "prepare".
+# A multi level approach is used. prepareN is processed before prepareN-1.
+# archprepare is used in arch Makefiles and when processed asm symlink,
+# version.h and scripts_basic is processed / created.
+
+# Listed in dependency order
+PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
+
+# prepare3 is used to check if we are building in a separate output directory,
+# and if so do:
+# 1) Check that make has not been executed in the kernel src $(srctree)
+prepare3:
+ifneq ($(KBUILD_SRC),)
+       @$(kecho) '  Using $(srctree) as source for u-boot'
+       $(Q)if [ -f $(srctree)/include/config.mk ]; then \
+               echo >&2 "  $(srctree) is not clean, please run 'make mrproper'"; \
+               echo >&2 "  in the '$(srctree)' directory.";\
+               /bin/false; \
+       fi;
+endif
+
+# prepare2 creates a makefile if using a separate output directory
+prepare2: prepare3 outputmakefile
+
+prepare1: prepare2
+       @:
+
+archprepare: prepare1 scripts_basic
+
+prepare0: archprepare FORCE
+       @:
+
+# All the preparing..
+prepare: prepare0
 
 #
 # Auto-generate the autoconf.mk file (which is included by all makefiles)
@@ -957,16 +1010,16 @@ include/autoconf.mk: include/config.h
 u-boot.lds: $(LDSCRIPT) depend
                $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
 
-nand_spl:      $(TIMESTAMP_FILE) $(VERSION_FILE) depend scripts_basic
+nand_spl:      $(TIMESTAMP_FILE) $(VERSION_FILE) depend prepare
                $(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all
 
 u-boot-nand.bin:       nand_spl u-boot.bin
                cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin
 
-spl/u-boot-spl.bin: tools depend scripts_basic
+spl/u-boot-spl.bin: tools depend prepare 
                $(MAKE) obj=spl -f $(srctree)/spl/Makefile all
 
-tpl/u-boot-tpl.bin: tools depend scripts_basic
+tpl/u-boot-tpl.bin: tools depend prepare
                $(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
 
 # Explicitly make _depend in subdirs containing multiple targets to prevent
@@ -1092,16 +1145,11 @@ $(TIMESTAMP_FILE):
                @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
                @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
 
-easylogo env gdb:
-       $(Q)$(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION}
+env: depend scripts_basic
+       $(Q)$(MAKE) $(build)=tools/$@
 
-gdbtools: gdb
-
-xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
-       $(Q)$(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@
-
-tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
-       $(Q)$(MAKE) $(build)=tools HOST_TOOLS_ALL=y
+tools-all: HOST_TOOLS_ALL=y
+tools-all: env tools ;
 
 .PHONY : CHANGELOG
 CHANGELOG:
@@ -1112,103 +1160,127 @@ include/license.h: tools/bin2header COPYING
        cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
 #########################################################################
 
+###
+# Cleaning is done on three levels.
+# make clean     Delete most generated files
+#                Leave enough to build external modules
+# make mrproper  Delete the current configuration, and all generated files
+# make distclean Remove editor backup files, patch leftover files and the like
+
+# Directories & files removed with 'make clean'
+CLEAN_DIRS  += $(MODVERDIR)
+CLEAN_FILES += u-boot.lds include/bmp_logo.h include/bmp_logo_data.h \
+              board/*/config.tmp board/*/*/config.tmp \
+              include/autoconf.mk* include/spl-autoconf.mk \
+              include/tpl-autoconf.mk
+
+# Directories & files removed with 'make clobber'
+CLOBBER_DIRS  += $(patsubst %,spl/%, $(filter-out Makefile, \
+                $(shell ls -1 spl 2>/dev/null))) \
+                tpl
+CLOBBER_FILES += u-boot* MLO MLO* SPL System.map nand_spl/u-boot*
+
+# Directories & files removed with 'make mrproper'
+MRPROPER_DIRS  += include/config include/generated
+MRPROPER_FILES += .config .config.old \
+                 tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
+                 include/config.h include/config.mk
+
+# clean - Delete most, but leave enough to build external modules
+#
+clean: rm-dirs  := $(CLEAN_DIRS)
+clean: rm-files := $(CLEAN_FILES)
+
+clean-dirs     := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $f/Makefile),$f))
+
+clean-dirs      := $(addprefix _clean_, $(clean-dirs) doc/DocBook)
+
+PHONY += $(clean-dirs) clean archclean
+$(clean-dirs):
+       $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
+
+# TODO: Do not use *.cfgtmp
+clean: $(clean-dirs)
+       $(call cmd,rmdirs)
+       $(call cmd,rmfiles)
+       @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
+               \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
+               -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \
+               -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
+               -o -name '*.symtypes' -o -name 'modules.order' \
+               -o -name modules.builtin -o -name '.tmp_*.o.*' \
+               -o -name '*.gcno' \) -type f -print | xargs rm -f
+       @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
+               -path './nand_spl/*' -type l -print | xargs rm -f
+
+# clobber
+#
+clobber: rm-dirs  := $(CLOBBER_DIRS)
+clobber: rm-files := $(CLOBBER_FILES)
 
-#########################################################################
-
-clean:
-       @rm -f examples/standalone/atmel_df_pow2                          \
-              examples/standalone/hello_world                            \
-              examples/standalone/interrupt                              \
-              examples/standalone/mem_to_mem_idma2intr                   \
-              examples/standalone/sched                                  \
-              $(addprefix examples/standalone/, smc91111_eeprom smc911x_eeprom) \
-              examples/standalone/test_burst                             \
-              examples/standalone/timer
-       @rm -f $(addprefix examples/api/, demo demo.bin)
-       @rm -f tools/bmp_logo      tools/easylogo/easylogo                \
-              tools/env/fw_printenv                                      \
-              tools/envcrc                                               \
-              $(addprefix tools/gdb/, gdbcont gdbsend)                   \
-              tools/gen_eth_addr    tools/img2srec                       \
-              tools/dumpimage                                            \
-              $(addprefix tools/, mkenvimage mkimage)                    \
-              tools/mpc86x_clk                                           \
-              $(addprefix tools/, mk$(BOARD)spl mkexynosspl)             \
-              tools/mxsboot                                              \
-              tools/ncb                   tools/ubsha1                   \
-              tools/kernel-doc/docproc                                   \
-              tools/proftool
-       @rm -f $(addprefix board/cray/L1/, bootscript.c bootscript.image) \
-              board/matrix_vision/*/bootscript.img                       \
-              spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl             \
-              u-boot.lds                                                 \
-              $(addprefix arch/blackfin/cpu/, init.lds init.elf)
-       @rm -f include/bmp_logo.h
-       @rm -f include/bmp_logo_data.h
-       @rm -f lib/asm-offsets.s
-       @rm -f include/generated/asm-offsets.h
-       @rm -f $(CPUDIR)/$(SOC)/asm-offsets.s
-       @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
-       @$(MAKE) -f $(srctree)/doc/DocBook/Makefile cleandocs
-       @find $(OBJTREE) -type f \
-               \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
-               -o -name '*.o'  -o -name '*.a' -o -name '*.exe' -o -name '*.cmd' \
-               -o -name '*.cfgtmp' \) -print \
-               | xargs rm -f
+PHONY += clobber
 
 clobber: clean
-       @find $(OBJTREE) -type f \( -name '*.srec' \
-               -o -name '*.bin' -o -name u-boot.img \) \
-               -print0 | xargs -0 rm -f
-       @rm -f *.bak ctags etags TAGS \
-               cscope.* *.*~
-       @rm -f u-boot u-boot.map u-boot.hex $(ALL-y)
-       @rm -f u-boot.kwb
-       @rm -f u-boot.pbl
-       @rm -f u-boot.imx
-       @rm -f u-boot-with-spl.imx
-       @rm -f u-boot-with-nand-spl.imx
-       @rm -f u-boot.ubl
-       @rm -f u-boot.ais
-       @rm -f u-boot.dtb
-       @rm -f u-boot.sb
-       @rm -f u-boot.spr
-       @rm -f $(addprefix nand_spl/, u-boot.lds u-boot.lst System.map)
-       @rm -f $(addprefix nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
-       @rm -f $(addprefix spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
-       @rm -f spl/u-boot-spl.lds
-       @rm -f $(addprefix tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
-       @rm -f tpl/u-boot-spl.lds
-       @rm -f MLO MLO.byteswap
-       @rm -f SPL
-       @rm -f tools/xway-swap-bytes
-       @rm -fr include/asm/proc include/asm/arch include/asm
-       @rm -fr include/generated
-       @[ ! -d nand_spl ] || find nand_spl -name "*" -type l -print | xargs rm -f
-       @rm -f dts/*.tmp
-       @rm -f $(addprefix spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
-
-mrproper: clobber
-       @rm -f include/config.h include/config.mk \
-               board/*/config.tmp board/*/*/config.tmp \
-               include/autoconf.mk include/autoconf.mk.dep \
-               include/spl-autoconf.mk \
-               include/tpl-autoconf.mk
+       $(call cmd,rmdirs)
+       $(call cmd,rmfiles)
+
+# mrproper - Delete all generated files, including .config
+#
+mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
+mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
+mrproper-dirs      := $(addprefix _mrproper_,scripts)
+
+PHONY += $(mrproper-dirs) mrproper archmrproper
+$(mrproper-dirs):
+       $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
+
+mrproper: clobber $(mrproper-dirs)
+       $(call cmd,rmdirs)
+       $(call cmd,rmfiles)
+       @rm -f arch/*/include/asm/arch arch/*/include/asm/proc
+
+# distclean
+#
+PHONY += distclean
 
 distclean: mrproper
-ifneq ($(OBJTREE),$(SRCTREE))
-       rm -rf *
-endif
+       @find $(srctree) $(RCS_FIND_IGNORE) \
+               \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
+               -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
+               -o -name '.*.rej' \
+               -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
+               -type f -print | xargs rm -f
 
 backup:
        F=`basename $(TOPDIR)` ; cd .. ; \
        gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
 
-#########################################################################
+
+# Documentation targets
+# ---------------------------------------------------------------------------
+%docs: scripts_basic FORCE
+       $(Q)$(MAKE) $(build)=scripts build_docproc
+       $(Q)$(MAKE) $(build)=doc/DocBook $@
+
+# Dummies...
+PHONY += prepare scripts
+prepare: ;
+scripts: ;
 
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
 
+quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
+      cmd_rmdirs = rm -rf $(rm-dirs)
+
+quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
+      cmd_rmfiles = rm -f $(rm-files)
+
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
+# Usage:
+# $(Q)$(MAKE) $(clean)=dir
+clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
+
 endif  # skip-makefile
 
 PHONY += FORCE