1 7ebf7443Swdenk# 2 44b333efSChander Kashyap# (C) Copyright 2000-2012 3 7ebf7443Swdenk# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4 7ebf7443Swdenk# 5 7ebf7443Swdenk# See file CREDITS for list of people who contributed to this 6 7ebf7443Swdenk# project. 7 7ebf7443Swdenk# 8 7ebf7443Swdenk# This program is free software; you can redistribute it and/or 9 7ebf7443Swdenk# modify it under the terms of the GNU General Public License as 10 45a212c4SWolfgang Denk# published by the Free Software Foundatio; either version 2 of 11 7ebf7443Swdenk# the License, or (at your option) any later version. 12 7ebf7443Swdenk# 13 7ebf7443Swdenk# This program is distributed in the hope that it will be useful, 14 7ebf7443Swdenk# but WITHOUT ANY WARRANTY; without even the implied warranty of 15 7ebf7443Swdenk# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 7ebf7443Swdenk# GNU General Public License for more details. 17 7ebf7443Swdenk# 18 7ebf7443Swdenk# You should have received a copy of the GNU General Public License 19 7ebf7443Swdenk# along with this program; if not, write to the Free Software 20 7ebf7443Swdenk# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 7ebf7443Swdenk# MA 02111-1307 USA 22 7ebf7443Swdenk# 23 7ebf7443Swdenk 24 42d44f63SWolfgang DenkVERSION = 2011 25 5738946bSWolfgang DenkPATCHLEVEL = 12 26 8b9e4787SWolfgang DenkSUBLEVEL = 27 cba9a894SWolfgang DenkEXTRAVERSION = 28 8b9e4787SWolfgang Denkifneq "$(SUBLEVEL)" "" 29 881a87ecSWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) 30 8b9e4787SWolfgang Denkelse 31 8b9e4787SWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION) 32 8b9e4787SWolfgang Denkendif 33 efb2172eSSimon GlassTIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h 34 efb2172eSSimon GlassVERSION_FILE = $(obj)include/generated/version_autogenerated.h 35 881a87ecSWolfgang Denk 36 7ebf7443SwdenkHOSTARCH := $(shell uname -m | \ 37 fea25720SGraeme Russ sed -e s/i.86/x86/ \ 38 7ebf7443Swdenk -e s/sun4u/sparc64/ \ 39 7ebf7443Swdenk -e s/arm.*/arm/ \ 40 7ebf7443Swdenk -e s/sa110/arm/ \ 41 d0179083SKumar Gala -e s/ppc64/powerpc/ \ 42 d0179083SKumar Gala -e s/ppc/powerpc/ \ 43 8d1f6355SNobuhiro Iwamatsu -e s/macppc/powerpc/\ 44 8d1f6355SNobuhiro Iwamatsu -e s/sh.*/sh/) 45 7ebf7443Swdenk 46 f9d77ed3SWolfgang DenkHOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ 47 7ebf7443Swdenk sed -e 's/\(cygwin\).*/cygwin/') 48 7ebf7443Swdenk 49 cf7a7b99SPeter Tyser# Set shell to bash if possible, otherwise fall back to sh 50 cf7a7b99SPeter TyserSHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 51 cf7a7b99SPeter Tyser else if [ -x /bin/bash ]; then echo /bin/bash; \ 52 cf7a7b99SPeter Tyser else echo sh; fi; fi) 53 cf7a7b99SPeter Tyser 54 cf7a7b99SPeter Tyserexport HOSTARCH HOSTOS SHELL 55 7ebf7443Swdenk 56 7ebf7443Swdenk# Deal with colliding definitions from tcsh etc. 57 7ebf7443SwdenkVENDOR= 58 7ebf7443Swdenk 59 7ebf7443Swdenk######################################################################### 60 ae6d1056SWolfgang Denk# Allow for silent builds 61 ae6d1056SWolfgang Denkifeq (,$(findstring s,$(MAKEFLAGS))) 62 ae6d1056SWolfgang DenkXECHO = echo 63 ae6d1056SWolfgang Denkelse 64 ae6d1056SWolfgang DenkXECHO = : 65 ae6d1056SWolfgang Denkendif 66 ae6d1056SWolfgang Denk 67 ae6d1056SWolfgang Denk######################################################################### 68 f9328639SMarian Balakowicz# 69 f9328639SMarian Balakowicz# U-boot build supports producing a object files to the separate external 70 f9328639SMarian Balakowicz# directory. Two use cases are supported: 71 f9328639SMarian Balakowicz# 72 f9328639SMarian Balakowicz# 1) Add O= to the make command line 73 f9328639SMarian Balakowicz# 'make O=/tmp/build all' 74 f9328639SMarian Balakowicz# 75 f9328639SMarian Balakowicz# 2) Set environement variable BUILD_DIR to point to the desired location 76 f9328639SMarian Balakowicz# 'export BUILD_DIR=/tmp/build' 77 f9328639SMarian Balakowicz# 'make' 78 f9328639SMarian Balakowicz# 79 f9328639SMarian Balakowicz# The second approach can also be used with a MAKEALL script 80 f9328639SMarian Balakowicz# 'export BUILD_DIR=/tmp/build' 81 f9328639SMarian Balakowicz# './MAKEALL' 82 f9328639SMarian Balakowicz# 83 f9328639SMarian Balakowicz# Command line 'O=' setting overrides BUILD_DIR environent variable. 84 f9328639SMarian Balakowicz# 85 f9328639SMarian Balakowicz# When none of the above methods is used the local build is performed and 86 f9328639SMarian Balakowicz# the object files are placed in the source directory. 87 f9328639SMarian Balakowicz# 88 7ebf7443Swdenk 89 f9328639SMarian Balakowiczifdef O 90 f9328639SMarian Balakowiczifeq ("$(origin O)", "command line") 91 f9328639SMarian BalakowiczBUILD_DIR := $(O) 92 f9328639SMarian Balakowiczendif 93 f9328639SMarian Balakowiczendif 94 7ebf7443Swdenk 95 f9328639SMarian Balakowiczifneq ($(BUILD_DIR),) 96 f9328639SMarian Balakowiczsaved-output := $(BUILD_DIR) 97 4f0645ebSMarian Balakowicz 98 4f0645ebSMarian Balakowicz# Attempt to create a output directory. 99 4f0645ebSMarian Balakowicz$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}) 100 4f0645ebSMarian Balakowicz 101 4f0645ebSMarian Balakowicz# Verify if it was successful. 102 f9328639SMarian BalakowiczBUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd) 103 f9328639SMarian Balakowicz$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) 104 f9328639SMarian Balakowiczendif # ifneq ($(BUILD_DIR),) 105 f9328639SMarian Balakowicz 106 f9328639SMarian BalakowiczOBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) 107 c8f9c302SDaniel SchwierzeckSPLTREE := $(OBJTREE)/spl 108 f9328639SMarian BalakowiczSRCTREE := $(CURDIR) 109 f9328639SMarian BalakowiczTOPDIR := $(SRCTREE) 110 f9328639SMarian BalakowiczLNDIR := $(OBJTREE) 111 c8f9c302SDaniel Schwierzeckexport TOPDIR SRCTREE OBJTREE SPLTREE 112 f9328639SMarian Balakowicz 113 f9328639SMarian BalakowiczMKCONFIG := $(SRCTREE)/mkconfig 114 f9328639SMarian Balakowiczexport MKCONFIG 115 f9328639SMarian Balakowicz 116 f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE)) 117 f9328639SMarian BalakowiczREMOTE_BUILD := 1 118 f9328639SMarian Balakowiczexport REMOTE_BUILD 119 f9328639SMarian Balakowiczendif 120 f9328639SMarian Balakowicz 121 f9328639SMarian Balakowicz# $(obj) and (src) are defined in config.mk but here in main Makefile 122 f9328639SMarian Balakowicz# we also need them before config.mk is included which is the case for 123 f9328639SMarian Balakowicz# some targets like unconfig, clean, clobber, distclean, etc. 124 f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE)) 125 f9328639SMarian Balakowiczobj := $(OBJTREE)/ 126 f9328639SMarian Balakowiczsrc := $(SRCTREE)/ 127 f9328639SMarian Balakowiczelse 128 f9328639SMarian Balakowiczobj := 129 f9328639SMarian Balakowiczsrc := 130 f9328639SMarian Balakowiczendif 131 f9328639SMarian Balakowiczexport obj src 132 f9328639SMarian Balakowicz 133 5013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere 134 5013c09fSWolfgang Denkunexport CDPATH 135 5013c09fSWolfgang Denk 136 f9328639SMarian Balakowicz######################################################################### 137 f9328639SMarian Balakowicz 138 6d1ce387SMike Frysinger# The "tools" are needed early, so put this first 139 6d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS) 140 349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC 141 349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled. 142 349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools 143 349e83f0SChe-liang ChiouSUBDIR_EXAMPLES = examples/standalone examples/api 144 349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS) 145 6d1ce387SMike Frysinger 146 249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE) 147 6d1ce387SMike Frysinger 148 ae6d1056SWolfgang Denkifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) 149 f9328639SMarian Balakowicz 150 2632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available 151 2632c008SMike Frysinger# to all top level build files. We need the dummy all: target to prevent the 152 2632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default. 153 2632c008SMike Frysingerall: 154 2632c008SMike Frysingersinclude $(obj)include/autoconf.mk.dep 155 2632c008SMike Frysingersinclude $(obj)include/autoconf.mk 156 2632c008SMike Frysinger 157 b5728756SSimon Glassifndef CONFIG_SANDBOX 158 b5728756SSimon GlassSUBDIRS += $(SUBDIR_EXAMPLES) 159 b5728756SSimon Glassendif 160 b5728756SSimon Glass 161 7ebf7443Swdenk# load ARCH, BOARD, and CPU configuration 162 ae6d1056SWolfgang Denkinclude $(obj)include/config.mk 163 1d9f4105Swdenkexport ARCH CPU BOARD VENDOR SOC 164 f9328639SMarian Balakowicz 165 1ea6bcd8SMike Frysinger# set default to nothing for native builds 166 a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH)) 167 1ea6bcd8SMike FrysingerCROSS_COMPILE ?= 168 7ebf7443Swdenkendif 169 7ebf7443Swdenk 170 92b197f0SWolfgang Denk# load other configuration 171 92b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk 172 92b197f0SWolfgang Denk 173 d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use 174 d51dfff7SIlya Yanok# that (or fail if absent). Otherwise, search for a linker script in a 175 d51dfff7SIlya Yanok# standard location. 176 d51dfff7SIlya Yanok 177 ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT)) 178 ee60197eSSimon Glass 179 d51dfff7SIlya Yanokifndef LDSCRIPT 180 d51dfff7SIlya Yanok #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug 181 d51dfff7SIlya Yanok ifdef CONFIG_SYS_LDSCRIPT 182 d51dfff7SIlya Yanok # need to strip off double quotes 183 d51dfff7SIlya Yanok LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT)) 184 d51dfff7SIlya Yanok endif 185 d51dfff7SIlya Yanokendif 186 d51dfff7SIlya Yanok 187 ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it 188 d51dfff7SIlya Yanokifndef LDSCRIPT 189 d51dfff7SIlya Yanok ifeq ($(CONFIG_NAND_U_BOOT),y) 190 d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds 191 d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 192 d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds 193 d51dfff7SIlya Yanok endif 194 d51dfff7SIlya Yanok endif 195 d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 196 d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds 197 d51dfff7SIlya Yanok endif 198 d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 199 d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds 200 d51dfff7SIlya Yanok endif 201 d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 202 ee60197eSSimon Glass LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds 203 ee60197eSSimon Glass # We don't expect a Makefile here 204 ee60197eSSimon Glass LDSCRIPT_MAKEFILE_DIR = 205 ee60197eSSimon Glass endif 206 ee60197eSSimon Glass ifeq ($(wildcard $(LDSCRIPT)),) 207 d51dfff7SIlya Yanok$(error could not find linker script) 208 d51dfff7SIlya Yanok endif 209 d51dfff7SIlya Yanokendif 210 d51dfff7SIlya Yanok 211 7ebf7443Swdenk######################################################################### 212 7ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first) 213 7ebf7443Swdenk 214 03b7004dSPeter TyserOBJS = $(CPUDIR)/start.o 215 fea25720SGraeme Russifeq ($(CPU),x86) 216 03b7004dSPeter TyserOBJS += $(CPUDIR)/start16.o 217 03b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 218 2262cfeeSwdenkendif 219 7ebf7443Swdenkifeq ($(CPU),ppc4xx) 220 03b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 221 7ebf7443Swdenkendif 222 42d1f039Swdenkifeq ($(CPU),mpc85xx) 223 03b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 224 42d1f039Swdenkendif 225 7ebf7443Swdenk 226 f9328639SMarian BalakowiczOBJS := $(addprefix $(obj),$(OBJS)) 227 f9328639SMarian Balakowicz 228 6d8962e8SSebastien CarlierLIBS = lib/libgeneric.o 229 6d8962e8SSebastien CarlierLIBS += lib/lzma/liblzma.o 230 6d8962e8SSebastien CarlierLIBS += lib/lzo/liblzo.o 231 e89516f0SMike FrysingerLIBS += lib/zlib/libz.o 232 7608d75fSKim PhillipsLIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \ 233 6d8962e8SSebastien Carlier "board/$(VENDOR)/common/lib$(VENDOR).o"; fi) 234 6d8962e8SSebastien CarlierLIBS += $(CPUDIR)/lib$(CPU).o 235 1d9f4105Swdenkifdef SOC 236 6d8962e8SSebastien CarlierLIBS += $(CPUDIR)/$(SOC)/lib$(SOC).o 237 1d9f4105Swdenkendif 238 323bfa8fSStefan Roeseifeq ($(CPU),ixp) 239 6d8962e8SSebastien CarlierLIBS += arch/arm/cpu/ixp/npe/libnpe.o 240 323bfa8fSStefan Roeseendif 241 bbb0b128SSimon Glassifeq ($(CONFIG_OF_EMBED),y) 242 bbb0b128SSimon GlassLIBS += dts/libdts.o 243 bbb0b128SSimon Glassendif 244 6d8962e8SSebastien CarlierLIBS += arch/$(ARCH)/lib/lib$(ARCH).o 245 6d8962e8SSebastien CarlierLIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \ 246 6d8962e8SSebastien Carlier fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \ 247 6d8962e8SSebastien Carlier fs/ubifs/libubifs.o 248 6d8962e8SSebastien CarlierLIBS += net/libnet.o 249 6d8962e8SSebastien CarlierLIBS += disk/libdisk.o 250 6d8962e8SSebastien CarlierLIBS += drivers/bios_emulator/libatibiosemu.o 251 6d8962e8SSebastien CarlierLIBS += drivers/block/libblock.o 252 6d8962e8SSebastien CarlierLIBS += drivers/dma/libdma.o 253 6d8962e8SSebastien CarlierLIBS += drivers/fpga/libfpga.o 254 6d8962e8SSebastien CarlierLIBS += drivers/gpio/libgpio.o 255 6d8962e8SSebastien CarlierLIBS += drivers/hwmon/libhwmon.o 256 6d8962e8SSebastien CarlierLIBS += drivers/i2c/libi2c.o 257 6d8962e8SSebastien CarlierLIBS += drivers/input/libinput.o 258 6d8962e8SSebastien CarlierLIBS += drivers/misc/libmisc.o 259 6d8962e8SSebastien CarlierLIBS += drivers/mmc/libmmc.o 260 6d8962e8SSebastien CarlierLIBS += drivers/mtd/libmtd.o 261 6d8962e8SSebastien CarlierLIBS += drivers/mtd/nand/libnand.o 262 6d8962e8SSebastien CarlierLIBS += drivers/mtd/onenand/libonenand.o 263 6d8962e8SSebastien CarlierLIBS += drivers/mtd/ubi/libubi.o 264 6d8962e8SSebastien CarlierLIBS += drivers/mtd/spi/libspi_flash.o 265 6d8962e8SSebastien CarlierLIBS += drivers/net/libnet.o 266 6d8962e8SSebastien CarlierLIBS += drivers/net/phy/libphy.o 267 6d8962e8SSebastien CarlierLIBS += drivers/pci/libpci.o 268 6d8962e8SSebastien CarlierLIBS += drivers/pcmcia/libpcmcia.o 269 6d8962e8SSebastien CarlierLIBS += drivers/power/libpower.o 270 6d8962e8SSebastien CarlierLIBS += drivers/spi/libspi.o 271 7737d5c6SDave Liuifeq ($(CPU),mpc83xx) 272 6d8962e8SSebastien CarlierLIBS += drivers/qe/libqe.o 273 d29d17d7SYork SunLIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o 274 6d8962e8SSebastien CarlierLIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o 275 7737d5c6SDave Liuendif 276 da9d4610SAndy Flemingifeq ($(CPU),mpc85xx) 277 6d8962e8SSebastien CarlierLIBS += drivers/qe/libqe.o 278 c916d7c9SKumar GalaLIBS += drivers/net/fm/libfm.o 279 6d8962e8SSebastien CarlierLIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o 280 6d8962e8SSebastien CarlierLIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o 281 58e5e9afSKumar Galaendif 282 58e5e9afSKumar Galaifeq ($(CPU),mpc86xx) 283 6d8962e8SSebastien CarlierLIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o 284 6d8962e8SSebastien CarlierLIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o 285 da9d4610SAndy Flemingendif 286 6d8962e8SSebastien CarlierLIBS += drivers/rtc/librtc.o 287 6d8962e8SSebastien CarlierLIBS += drivers/serial/libserial.o 288 5e124724SVadim Bendeburyifeq ($(CONFIG_GENERIC_LPC_TPM),y) 289 5e124724SVadim BendeburyLIBS += drivers/tpm/libtpm.o 290 5e124724SVadim Bendeburyendif 291 6d8962e8SSebastien CarlierLIBS += drivers/twserial/libtws.o 292 181f565cSMike FrysingerLIBS += drivers/usb/eth/libusb_eth.o 293 6d8962e8SSebastien CarlierLIBS += drivers/usb/gadget/libusb_gadget.o 294 6d8962e8SSebastien CarlierLIBS += drivers/usb/host/libusb_host.o 295 6d8962e8SSebastien CarlierLIBS += drivers/usb/musb/libusb_musb.o 296 6d8962e8SSebastien CarlierLIBS += drivers/usb/phy/libusb_phy.o 297 f93022c3SJana RapavaLIBS += drivers/usb/ulpi/libusb_ulpi.o 298 6d8962e8SSebastien CarlierLIBS += drivers/video/libvideo.o 299 6d8962e8SSebastien CarlierLIBS += drivers/watchdog/libwatchdog.o 300 6d8962e8SSebastien CarlierLIBS += common/libcommon.o 301 6d8962e8SSebastien CarlierLIBS += lib/libfdt/libfdt.o 302 6d8962e8SSebastien CarlierLIBS += api/libapi.o 303 6d8962e8SSebastien CarlierLIBS += post/libpost.o 304 f9328639SMarian Balakowicz 305 f16da746SChandan Nathifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) 306 f0f4b5ffSChandan NathLIBS += $(CPUDIR)/omap-common/libomap-common.o 307 f0f4b5ffSChandan Nathendif 308 18936ee2SJason Liu 309 18936ee2SJason Liuifeq ($(SOC),mx5) 310 18936ee2SJason LiuLIBS += $(CPUDIR)/imx-common/libimx-common.o 311 18936ee2SJason Liuendif 312 18936ee2SJason Liuifeq ($(SOC),mx6) 313 18936ee2SJason LiuLIBS += $(CPUDIR)/imx-common/libimx-common.o 314 18936ee2SJason Liuendif 315 18936ee2SJason Liu 316 852bd07cSMinkyu Kangifeq ($(SOC),s5pc1xx) 317 6d8962e8SSebastien CarlierLIBS += $(CPUDIR)/s5p-common/libs5p-common.o 318 852bd07cSMinkyu Kangendif 319 393cb361SChander Kashyapifeq ($(SOC),exynos) 320 6d8962e8SSebastien CarlierLIBS += $(CPUDIR)/s5p-common/libs5p-common.o 321 852bd07cSMinkyu Kangendif 322 852bd07cSMinkyu Kang 323 566d49a3SWolfgang DenkLIBS := $(addprefix $(obj),$(sort $(LIBS))) 324 249b53a6SLoïc Minier.PHONY : $(LIBS) 325 a8c7c708Swdenk 326 6d8962e8SSebastien CarlierLIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o 327 de109d90SWolfgang DenkLIBBOARD := $(addprefix $(obj),$(LIBBOARD)) 328 de109d90SWolfgang Denk 329 4f7cb08eSwdenk# Add GCC lib 330 52b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC 331 52b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes") 332 635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o 333 52b1bf2cSWolfgang Denkelse 334 52b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc 335 52b1bf2cSWolfgang Denkendif 336 52b1bf2cSWolfgang Denkelse 337 cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc 338 52b1bf2cSWolfgang Denkendif 339 52b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC) 340 52b1bf2cSWolfgang Denkexport PLATFORM_LIBS 341 3d3befa7Swdenk 342 6ac9f479SMike Frysinger# Special flags for CPP when processing the linker script. 343 6ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility 344 6ac9f479SMike Frysinger# on the fly. 345 6ac9f479SMike FrysingerLDPPFLAGS += \ 346 6ac9f479SMike Frysinger -include $(TOPDIR)/include/u-boot/u-boot.lds.h \ 347 *7e6403a6SSimon Glass -DCPUDIR=$(CPUDIR) \ 348 6ac9f479SMike Frysinger $(shell $(LD) --version | \ 349 6ac9f479SMike Frysinger sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') 350 6ac9f479SMike Frysinger 351 f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS)) 352 de109d90SWolfgang Denk__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD)) 353 f9328639SMarian Balakowicz 354 7ebf7443Swdenk######################################################################### 355 bdccc4feSwdenk######################################################################### 356 7ebf7443Swdenk 357 f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),) 358 f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \ 359 f3a14d37SMike Frysinger @actual=`wc -c $@ | awk '{print $$1}'`; \ 360 f3a14d37SMike Frysinger limit=$(CONFIG_BOARD_SIZE_LIMIT); \ 361 f3a14d37SMike Frysinger if test $$actual -gt $$limit; then \ 362 f3a14d37SMike Frysinger echo "$@ exceeds file size limit:"; \ 363 f3a14d37SMike Frysinger echo " limit: $$limit bytes"; \ 364 f3a14d37SMike Frysinger echo " actual: $$actual bytes"; \ 365 f3a14d37SMike Frysinger echo " excess: $$((actual - limit)) bytes"; \ 366 f3a14d37SMike Frysinger exit 1; \ 367 f3a14d37SMike Frysinger fi 368 f3a14d37SMike Frysingerelse 369 f3a14d37SMike FrysingerBOARD_SIZE_CHECK = 370 f3a14d37SMike Frysingerendif 371 f3a14d37SMike Frysinger 372 3e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones 373 4e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map 374 e935a374SHaiying Wang 375 4e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin 376 4e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin 377 e935a374SHaiying WangONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin 378 5df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin 379 2c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin 380 7ebf7443Swdenk 381 349e83f0SChe-liang Chiouall: $(ALL-y) $(SUBDIR_EXAMPLES) 382 7ebf7443Swdenk 383 2c0f79e4SSimon Glass$(obj)u-boot.dtb: $(obj)u-boot 384 2c0f79e4SSimon Glass $(MAKE) -C dts binary 385 2c0f79e4SSimon Glass mv $(obj)dts/dt.dtb $@ 386 2c0f79e4SSimon Glass 387 2c0f79e4SSimon Glass$(obj)u-boot-dtb.bin: $(obj)u-boot.bin $(obj)u-boot.dtb 388 2c0f79e4SSimon Glass cat $^ >$@ 389 2c0f79e4SSimon Glass 390 f9328639SMarian Balakowicz$(obj)u-boot.hex: $(obj)u-boot 391 6310eb9dSwdenk $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ 392 6310eb9dSwdenk 393 f9328639SMarian Balakowicz$(obj)u-boot.srec: $(obj)u-boot 394 0817d688SRicardo Ribalda Delgado $(OBJCOPY) -O srec $< $@ 395 7ebf7443Swdenk 396 f9328639SMarian Balakowicz$(obj)u-boot.bin: $(obj)u-boot 397 7ebf7443Swdenk $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ 398 f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 399 7ebf7443Swdenk 400 94a91e24SMike Frysinger$(obj)u-boot.ldr: $(obj)u-boot 401 76d82187SMike Frysinger $(CREATE_LDR_ENV) 402 68e56324SMike Frysinger $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) 403 f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 404 94a91e24SMike Frysinger 405 94a91e24SMike Frysinger$(obj)u-boot.ldr.hex: $(obj)u-boot.ldr 406 94a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary 407 94a91e24SMike Frysinger 408 94a91e24SMike Frysinger$(obj)u-boot.ldr.srec: $(obj)u-boot.ldr 409 94a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary 410 94a91e24SMike Frysinger 411 f9328639SMarian Balakowicz$(obj)u-boot.img: $(obj)u-boot.bin 412 a2a0a717SWolfgang Denk $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ 413 3857f8f5Saneeshv -O u-boot -a $(CONFIG_SYS_TEXT_BASE) -e 0 \ 414 881a87ecSWolfgang Denk -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ 415 bdccc4feSwdenk sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ 416 bdccc4feSwdenk -d $< $@ 417 bdccc4feSwdenk 418 8edcde5eSStefano Babic$(obj)u-boot.imx: $(obj)u-boot.bin 419 45d7d72bSStefano Babic $(obj)tools/mkimage -n $(CONFIG_IMX_CONFIG) -T imximage \ 420 14d0a02aSWolfgang Denk -e $(CONFIG_SYS_TEXT_BASE) -d $< $@ 421 8edcde5eSStefano Babic 422 aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb: $(obj)u-boot.bin 423 31d80c77SPrafulla Wadaskar $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \ 424 2ea88b06SEric Cooper -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@ 425 aa0c7a86SPrafulla Wadaskar 426 566a494fSHeiko Schocher$(obj)u-boot.sha1: $(obj)u-boot.bin 427 01159530SHeiko Schocher $(obj)tools/ubsha1 $(obj)u-boot.bin 428 566a494fSHeiko Schocher 429 f9328639SMarian Balakowicz$(obj)u-boot.dis: $(obj)u-boot 430 7ebf7443Swdenk $(OBJDUMP) -d $< > $@ 431 7ebf7443Swdenk 432 435199f3SHeiko Schocher$(obj)u-boot.ubl: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 433 435199f3SHeiko Schocher $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin 434 435199f3SHeiko Schocher cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin 435 7816f2cfSHeiko Schocher $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \ 436 435199f3SHeiko Schocher -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl 437 435199f3SHeiko Schocher rm $(obj)u-boot-ubl.bin 438 435199f3SHeiko Schocher rm $(obj)spl/u-boot-spl-pad.bin 439 7816f2cfSHeiko Schocher 440 d36d8859SChristian Riesch$(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 441 d36d8859SChristian Riesch $(obj)tools/mkimage -s -n /dev/null -T aisimage \ 442 d36d8859SChristian Riesch -e $(CONFIG_SPL_TEXT_BASE) \ 443 d36d8859SChristian Riesch -d $(obj)spl/u-boot-spl.bin \ 444 d36d8859SChristian Riesch $(obj)spl/u-boot-spl.ais 445 d36d8859SChristian Riesch $(OBJCOPY) ${OBJCFLAGS} -I binary \ 446 d36d8859SChristian Riesch --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \ 447 d36d8859SChristian Riesch $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais 448 d36d8859SChristian Riesch cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \ 449 d36d8859SChristian Riesch $(obj)u-boot.ais 450 d36d8859SChristian Riesch rm $(obj)spl/u-boot-spl{,-pad}.ais 451 d36d8859SChristian Riesch 452 30b9b932SMarek Vasut$(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin 453 30b9b932SMarek Vasut elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \ 454 30b9b932SMarek Vasut -o $(obj)u-boot.sb 455 30b9b932SMarek Vasut 456 86eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y) 457 86eb49b3SSimon GlassGEN_UBOOT = \ 458 86eb49b3SSimon Glass cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \ 459 86eb49b3SSimon Glass -Wl,--start-group $(__LIBS) -Wl,--end-group \ 460 86eb49b3SSimon Glass $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot 461 86eb49b3SSimon Glasselse 462 ecb1dc89SMike FrysingerGEN_UBOOT = \ 463 de109d90SWolfgang Denk UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \ 464 de109d90SWolfgang Denk sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ 465 8aba9dceSNobuhiro Iwamatsu cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__OBJS) \ 466 f9328639SMarian Balakowicz --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ 467 b2184c31Swdenk -Map u-boot.map -o u-boot 468 86eb49b3SSimon Glassendif 469 86eb49b3SSimon Glass 470 16a354f9SWolfgang Denk$(obj)u-boot: depend \ 471 349e83f0SChe-liang Chiou $(SUBDIR_TOOLS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds 472 ecb1dc89SMike Frysinger $(GEN_UBOOT) 473 ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y) 474 1aada9cdSWolfgang Denk smap=`$(call SYSTEM_MAP,u-boot) | \ 475 1aada9cdSWolfgang Denk awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ 476 1aada9cdSWolfgang Denk $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \ 477 1aada9cdSWolfgang Denk -c common/system_map.c -o $(obj)common/system_map.o 478 ecb1dc89SMike Frysinger $(GEN_UBOOT) $(obj)common/system_map.o 479 ecb1dc89SMike Frysingerendif 480 7ebf7443Swdenk 481 d0d6144eSPeter Tyser$(OBJS): depend 482 03b7004dSPeter Tyser $(MAKE) -C $(CPUDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@)) 483 f9328639SMarian Balakowicz 484 349e83f0SChe-liang Chiou$(LIBS): depend $(SUBDIR_TOOLS) 485 f9328639SMarian Balakowicz $(MAKE) -C $(dir $(subst $(obj),,$@)) 486 a8c7c708Swdenk 487 d0d6144eSPeter Tyser$(LIBBOARD): depend $(LIBS) 488 de109d90SWolfgang Denk $(MAKE) -C $(dir $(subst $(obj),,$@)) 489 de109d90SWolfgang Denk 490 d0d6144eSPeter Tyser$(SUBDIRS): depend 491 b028f715Swdenk $(MAKE) -C $@ all 492 7ebf7443Swdenk 493 349e83f0SChe-liang Chiou$(SUBDIR_EXAMPLES): $(obj)u-boot 494 349e83f0SChe-liang Chiou 495 d0d6144eSPeter Tyser$(LDSCRIPT): depend 496 f65c9812SMike Frysinger $(MAKE) -C $(dir $@) $(notdir $@) 497 f65c9812SMike Frysinger 498 1aada9cdSWolfgang Denk$(obj)u-boot.lds: $(LDSCRIPT) 499 1aada9cdSWolfgang Denk $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ 500 1aada9cdSWolfgang Denk 501 e935a374SHaiying Wangnand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend 502 8318fbf8SMarian Balakowicz $(MAKE) -C nand_spl/board/$(BOARDDIR) all 503 887e2ec9SStefan Roese 504 e935a374SHaiying Wang$(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin 505 8318fbf8SMarian Balakowicz cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin 506 887e2ec9SStefan Roese 507 e935a374SHaiying Wangonenand_ipl: $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk 508 f2302d44SStefan Roese $(MAKE) -C onenand_ipl/board/$(BOARDDIR) all 509 751b9b51SKyungmin Park 510 e935a374SHaiying Wang$(obj)u-boot-onenand.bin: onenand_ipl $(obj)u-boot.bin 511 ca6189dbSKyungmin Park cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin 512 751b9b51SKyungmin Park 513 bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend 514 5df2ee27SDaniel Schwierzeck $(MAKE) -C spl all 515 5df2ee27SDaniel Schwierzeck 516 f9328639SMarian Balakowiczupdater: 517 0358df42SMike Frysinger $(MAKE) -C tools/updater all 518 8f713fdfSdzu 519 2a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent 520 2a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously. 521 16a354f9SWolfgang Denkdepend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ 522 16a354f9SWolfgang Denk $(obj)include/autoconf.mk \ 523 a4814a69SStefano Babic $(obj)include/generated/generic-asm-offsets.h \ 524 a4814a69SStefano Babic $(obj)include/generated/asm-offsets.h 525 ee60197eSSimon Glass for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do \ 526 2a998793SDaniel Hobi $(MAKE) -C $$dir _depend ; done 527 7ebf7443Swdenk 528 e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS) 529 e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS)) 530 a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include 531 a340c325SJean-Christophe PLAGNIOL-VILLARD 532 857d9ea6SHorst KronstorferFIND := find 533 857d9ea6SHorst KronstorferFINDFLAGS := -L 534 857d9ea6SHorst Kronstorfer 535 1064d980STom Rinicheckstack: 536 1064d980STom Rini $(CROSS_COMPILE)objdump -d $(obj)u-boot \ 537 1064d980STom Rini `$(FIND) $(obj) -name u-boot-spl -print` | \ 538 1064d980STom Rini perl $(src)tools/checkstack.pl $(ARCH) 539 1064d980STom Rini 540 f9328639SMarian Balakowicztags ctags: 541 857d9ea6SHorst Kronstorfer ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 542 e5e4e705SLi Yang -name '*.[chS]' -print` 543 7ebf7443Swdenk 544 7ebf7443Swdenketags: 545 857d9ea6SHorst Kronstorfer etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 546 e5e4e705SLi Yang -name '*.[chS]' -print` 547 ffda586fSLi Yangcscope: 548 857d9ea6SHorst Kronstorfer $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ 549 857d9ea6SHorst Kronstorfer cscope.files 550 ffda586fSLi Yang cscope -b -q -k 551 7ebf7443Swdenk 552 ecb1dc89SMike FrysingerSYSTEM_MAP = \ 553 ecb1dc89SMike Frysinger $(NM) $1 | \ 554 7ebf7443Swdenk grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ 555 ecb1dc89SMike Frysinger LC_ALL=C sort 556 ecb1dc89SMike Frysinger$(obj)System.map: $(obj)u-boot 557 ecb1dc89SMike Frysinger @$(call SYSTEM_MAP,$<) > $(obj)System.map 558 7ebf7443Swdenk 559 2f155f6cSGrant Likely# 560 2f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles) 561 2f155f6cSGrant Likely# 562 2f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. 563 2f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when 564 2f155f6cSGrant Likely# to regenerate the autoconf.mk file. 565 1510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h 566 1510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 567 16fe7775SMike Frysinger set -e ; \ 568 ae6d1056SWolfgang Denk : Generate the dependancies ; \ 569 4c34b2a0SMike Frysinger $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \ 570 1510b82dSWolfgang Denk -MQ $(obj)include/autoconf.mk include/common.h > $@ 571 1510b82dSWolfgang Denk 572 1510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h 573 1510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 574 1510b82dSWolfgang Denk set -e ; \ 575 ae6d1056SWolfgang Denk : Extract the config macros ; \ 576 1510b82dSWolfgang Denk $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \ 577 4a0f7538SWolfgang Denk sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 578 4a0f7538SWolfgang Denk mv $@.tmp $@ 579 2f155f6cSGrant Likely 580 16a354f9SWolfgang Denk$(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \ 581 16a354f9SWolfgang Denk $(obj)lib/asm-offsets.s 582 16a354f9SWolfgang Denk @$(XECHO) Generating $@ 583 16a354f9SWolfgang Denk tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@ 584 16a354f9SWolfgang Denk 585 16a354f9SWolfgang Denk$(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ 586 16a354f9SWolfgang Denk $(src)lib/asm-offsets.c 587 16a354f9SWolfgang Denk @mkdir -p $(obj)lib 588 16a354f9SWolfgang Denk $(CC) -DDO_DEPS_ONLY \ 589 16a354f9SWolfgang Denk $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 590 16a354f9SWolfgang Denk -o $@ $(src)lib/asm-offsets.c -c -S 591 16a354f9SWolfgang Denk 592 a4814a69SStefano Babic$(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \ 593 a4814a69SStefano Babic $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s 594 a4814a69SStefano Babic @echo Generating $@ 595 a4814a69SStefano Babic tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@ 596 a4814a69SStefano Babic 597 a4814a69SStefano Babic$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep 598 a4814a69SStefano Babic @mkdir -p $(obj)$(CPUDIR)/$(SOC) 599 a4814a69SStefano Babic if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ 600 a4814a69SStefano Babic $(CC) -DDO_DEPS_ONLY \ 601 a4814a69SStefano Babic $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 602 a4814a69SStefano Babic -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \ 603 a4814a69SStefano Babic else \ 604 a4814a69SStefano Babic touch $@; \ 605 a4814a69SStefano Babic fi 606 a4814a69SStefano Babic 607 7ebf7443Swdenk######################################################################### 608 ae6d1056SWolfgang Denkelse # !config.mk 609 f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ 610 f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \ 611 249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \ 612 0358df42SMike Frysingerupdater depend dep tags ctags etags cscope $(obj)System.map: 613 7ebf7443Swdenk @echo "System not configured - see README" >&2 614 7ebf7443Swdenk @ exit 1 615 c7c0d542SMike Frysinger 616 249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE) 617 0358df42SMike Frysinger $(MAKE) -C $@ all 618 ae6d1056SWolfgang Denkendif # config.mk 619 7ebf7443Swdenk 620 28abd48fSIlya Yanok$(VERSION_FILE): 621 14ce91b1SMike Frysinger @mkdir -p $(dir $(VERSION_FILE)) 622 28abd48fSIlya Yanok @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ 623 28abd48fSIlya Yanok printf '#define PLAIN_VERSION "%s%s"\n' \ 624 28abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 625 28abd48fSIlya Yanok printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ 626 28abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 627 28abd48fSIlya Yanok ) > $@.tmp 628 28abd48fSIlya Yanok @( printf '#define CC_VERSION_STRING "%s"\n' \ 629 28abd48fSIlya Yanok '$(shell $(CC) --version | head -n 1)' )>> $@.tmp 630 28abd48fSIlya Yanok @( printf '#define LD_VERSION_STRING "%s"\n' \ 631 28abd48fSIlya Yanok '$(shell $(LD) -v | head -n 1)' )>> $@.tmp 632 28abd48fSIlya Yanok @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 633 28abd48fSIlya Yanok 634 249b53a6SLoïc Minier$(TIMESTAMP_FILE): 635 249b53a6SLoïc Minier @mkdir -p $(dir $(TIMESTAMP_FILE)) 636 a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp 637 a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp 638 a76406fbSLoïc Minier @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 639 249b53a6SLoïc Minier 640 0358df42SMike Frysingereasylogo env gdb: 641 0358df42SMike Frysinger $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} 642 0358df42SMike Frysingergdbtools: gdb 643 0358df42SMike Frysinger 644 249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE) 645 0358df42SMike Frysinger $(MAKE) -C tools HOST_TOOLS_ALL=y 646 0358df42SMike Frysinger 647 4e53a258SWolfgang Denk.PHONY : CHANGELOG 648 4e53a258SWolfgang DenkCHANGELOG: 649 b985b5d6SBen Warren git log --no-merges U-Boot-1_1_5.. | \ 650 b985b5d6SBen Warren unexpand -a | sed -e 's/\s\s*$$//' > $@ 651 4e53a258SWolfgang Denk 652 0a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING 653 0a823aa2SHarald Welte cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h 654 7ebf7443Swdenk######################################################################### 655 7ebf7443Swdenk 656 7ebf7443Swdenkunconfig: 657 887e2ec9SStefan Roese @rm -f $(obj)include/config.h $(obj)include/config.mk \ 658 2f155f6cSGrant Likely $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ 659 2f155f6cSGrant Likely $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep 660 7ebf7443Swdenk 661 a6862bc1SWolfgang Denk%_config:: unconfig 662 a6862bc1SWolfgang Denk @$(MKCONFIG) -A $(@:_config=) 663 a6862bc1SWolfgang Denk 664 d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend 665 d6a5e6d5SLoïc Minier$(obj).boards.depend: boards.cfg 666 37d0e777SLauri Hintsala @awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@ 667 9f4a4206SMike Frysinger 668 8c994630SWolfgang Denk# 669 8c994630SWolfgang Denk# Functions to generate common board directory names 670 8c994630SWolfgang Denk# 671 8c994630SWolfgang Denklcname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/') 672 8c994630SWolfgang Denkucname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/') 673 8c994630SWolfgang Denk 674 7ebf7443Swdenk#======================================================================== 675 7ebf7443Swdenk# ARM 676 7ebf7443Swdenk#======================================================================== 677 43a5f0dfSPo-Yu Chuang 678 47fd3bffSJean-Christophe PLAGNIOL-VILLARDSX1_stdout_serial_config \ 679 2d24a3a7SwdenkSX1_config: unconfig 680 47fd3bffSJean-Christophe PLAGNIOL-VILLARD @mkdir -p $(obj)include 681 47fd3bffSJean-Christophe PLAGNIOL-VILLARD @if [ "$(findstring _stdout_serial_, $@)" ] ; then \ 682 47fd3bffSJean-Christophe PLAGNIOL-VILLARD echo "#undef CONFIG_STDOUT_USBTTY" >> $(obj)include/config.h ; \ 683 47fd3bffSJean-Christophe PLAGNIOL-VILLARD else \ 684 47fd3bffSJean-Christophe PLAGNIOL-VILLARD echo "#define CONFIG_STDOUT_USBTTY" >> $(obj)include/config.h ; \ 685 47fd3bffSJean-Christophe PLAGNIOL-VILLARD fi; 686 0e42ada3SWolfgang Denk @$(MKCONFIG) -n $@ SX1 arm arm925t sx1 687 2d24a3a7Swdenk 688 699f0512SWolfgang Denk######################################################################### 689 11edcfe2SGuennadi Liakhovetski## ARM1176 Systems 690 11edcfe2SGuennadi Liakhovetski######################################################################### 691 11edcfe2SGuennadi Liakhovetskismdk6400_noUSB_config \ 692 11edcfe2SGuennadi Liakhovetskismdk6400_config : unconfig 693 11edcfe2SGuennadi Liakhovetski @mkdir -p $(obj)include $(obj)board/samsung/smdk6400 694 11edcfe2SGuennadi Liakhovetski @mkdir -p $(obj)nand_spl/board/samsung/smdk6400 695 11edcfe2SGuennadi Liakhovetski @echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h 696 0e42ada3SWolfgang Denk @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk 697 11edcfe2SGuennadi Liakhovetski @if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then \ 698 11edcfe2SGuennadi Liakhovetski echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\ 699 11edcfe2SGuennadi Liakhovetski else \ 700 11edcfe2SGuennadi Liakhovetski echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\ 701 11edcfe2SGuennadi Liakhovetski fi 702 54e19a7dSWolfgang Denk @$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx 703 11edcfe2SGuennadi Liakhovetski @echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk 704 11edcfe2SGuennadi Liakhovetski 705 0afe519aSWolfgang Denk######################################################################### 706 3e38691eSwdenk######################################################################### 707 7ebf7443Swdenk 708 7ebf7443Swdenkclean: 709 1bc15386SPeter Tyser @rm -f $(obj)examples/standalone/82559_eeprom \ 710 d640ac58SWolfgang Denk $(obj)examples/standalone/atmel_df_pow2 \ 711 1bc15386SPeter Tyser $(obj)examples/standalone/eepro100_eeprom \ 712 1bc15386SPeter Tyser $(obj)examples/standalone/hello_world \ 713 1bc15386SPeter Tyser $(obj)examples/standalone/interrupt \ 714 1bc15386SPeter Tyser $(obj)examples/standalone/mem_to_mem_idma2intr \ 715 1bc15386SPeter Tyser $(obj)examples/standalone/sched \ 716 201a017cSMike Frysinger $(obj)examples/standalone/smc911{11,x}_eeprom \ 717 1bc15386SPeter Tyser $(obj)examples/standalone/test_burst \ 718 1bc15386SPeter Tyser $(obj)examples/standalone/timer 719 d4abc757SPeter Tyser @rm -f $(obj)examples/api/demo{,.bin} 720 f9301e1cSWolfgang Denk @rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \ 721 f9301e1cSWolfgang Denk $(obj)tools/env/{fw_printenv,fw_setenv} \ 722 f9301e1cSWolfgang Denk $(obj)tools/envcrc \ 723 f9301e1cSWolfgang Denk $(obj)tools/gdb/{astest,gdbcont,gdbsend} \ 724 f9301e1cSWolfgang Denk $(obj)tools/gen_eth_addr $(obj)tools/img2srec \ 725 7717fe10SHorst Kronstorfer $(obj)tools/mk{env,}image $(obj)tools/mpc86x_clk \ 726 81e35203SChander Kashyap $(obj)tools/mk{smdk5250,}spl \ 727 f9301e1cSWolfgang Denk $(obj)tools/ncb $(obj)tools/ubsha1 728 f9301e1cSWolfgang Denk @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image} \ 729 74c7a95fSWolfgang Denk $(obj)board/matrix_vision/*/bootscript.img \ 730 566e5cf4SWolfgang Denk $(obj)board/voiceblue/eeprom \ 731 1aada9cdSWolfgang Denk $(obj)u-boot.lds \ 732 fb5166ceSMike Frysinger $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ 733 fb5166ceSMike Frysinger $(obj)arch/blackfin/cpu/init.{lds,elf} 734 dc7746d8SWolfgang Denk @rm -f $(obj)include/bmp_logo.h 735 c270730fSChe-Liang Chiou @rm -f $(obj)include/bmp_logo_data.h 736 16a354f9SWolfgang Denk @rm -f $(obj)lib/asm-offsets.s 737 a4814a69SStefano Babic @rm -f $(obj)include/generated/asm-offsets.h 738 a4814a69SStefano Babic @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s 739 ff6b47adSKumar Gala @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map} 740 ca6189dbSKyungmin Park @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map} 741 ca6189dbSKyungmin Park @rm -f $(ONENAND_BIN) 742 1aada9cdSWolfgang Denk @rm -f $(obj)onenand_ipl/u-boot.lds 743 5df2ee27SDaniel Schwierzeck @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.lds,u-boot-spl.map} 744 4e4b21bdSJoel A Fernandes @rm -f $(obj)MLO 745 d4abc757SPeter Tyser @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) 746 ae6d1056SWolfgang Denk @find $(OBJTREE) -type f \ 747 4a30f1e8STom Rini \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \ 748 2b48f7d5SPeter Tyser -o -name '*.o' -o -name '*.a' -o -name '*.exe' \) -print \ 749 7ebf7443Swdenk | xargs rm -f 750 7ebf7443Swdenk 751 734329f9SAndy Fleming# Removes everything not needed for testing u-boot 752 734329f9SAndy Flemingtidy: clean 753 734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f 754 734329f9SAndy Fleming 755 734329f9SAndy Flemingclobber: tidy 756 734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.srec' \ 757 734329f9SAndy Fleming -o -name '*.bin' -o -name u-boot.img \) \ 758 734329f9SAndy Fleming -print0 | xargs -0 rm -f 759 ffda586fSLi Yang @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ 760 5013c09fSWolfgang Denk $(obj)cscope.* $(obj)*.*~ 761 4e0fbb98SDaniel Schwierzeck @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y) 762 aa0c7a86SPrafulla Wadaskar @rm -f $(obj)u-boot.kwb 763 c5fb70c9SStefano Babic @rm -f $(obj)u-boot.imx 764 7816f2cfSHeiko Schocher @rm -f $(obj)u-boot.ubl 765 d36d8859SChristian Riesch @rm -f $(obj)u-boot.ais 766 bbb0b128SSimon Glass @rm -f $(obj)u-boot.dtb 767 30b9b932SMarek Vasut @rm -f $(obj)u-boot.sb 768 dca61f01SAndreas Bießmann @rm -f $(obj)tools/inca-swap-bytes 769 a47a12beSStefan Roese @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c 770 2d14e36aSYork Sun @rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c 771 a9d8bc98SLoïc Minier @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm 772 16a354f9SWolfgang Denk @rm -fr $(obj)include/generated 773 a958b663SJean-Christophe PLAGNIOL-VILLARD @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f 774 a958b663SJean-Christophe PLAGNIOL-VILLARD @[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f 775 bbb0b128SSimon Glass @rm -f $(obj)dts/*.tmp 776 7ebf7443Swdenk 777 7ebf7443Swdenkmrproper \ 778 7ebf7443Swdenkdistclean: clobber unconfig 779 afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE)) 780 ae6d1056SWolfgang Denk rm -rf $(obj)* 781 f9328639SMarian Balakowiczendif 782 7ebf7443Swdenk 783 7ebf7443Swdenkbackup: 784 7ebf7443Swdenk F=`basename $(TOPDIR)` ; cd .. ; \ 785 d6b93714SIlya Yanok gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F 786 7ebf7443Swdenk 787 7ebf7443Swdenk######################################################################### 788