Blame view

Makefile 25.1 KB
7ebf7443a   wdenk   Initial revision
1
  #
44b333ef4   Chander Kashyap   Makefile: Remove ...
2
  # (C) Copyright 2000-2012
7ebf7443a   wdenk   Initial revision
3
4
5
6
7
8
9
  # 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
45a212c4d   Wolfgang Denk   Add support for n...
10
  # published by the Free Software Foundatio; either version 2 of
7ebf7443a   wdenk   Initial revision
11
12
13
14
  # 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
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
15
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
7ebf7443a   wdenk   Initial revision
16
17
18
19
20
21
22
  # 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
  #
c008b6f6d   Wolfgang Denk   Prepare v2012.04-rc1
23
24
  VERSION = 2012
  PATCHLEVEL = 04
415d38687   Wolfgang Denk   Prepare v2012.04.01
25
  SUBLEVEL = 01
2790bf69d   Wolfgang Denk   Prepare v2012.04
26
  EXTRAVERSION =
8b9e47876   Wolfgang Denk   Update CHANGELOG,...
27
  ifneq "$(SUBLEVEL)" ""
881a87ecb   Wolfgang Denk   Add GIT version i...
28
  U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
8b9e47876   Wolfgang Denk   Update CHANGELOG,...
29
30
31
  else
  U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
  endif
efb2172ec   Simon Glass   Move timestamp an...
32
33
  TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
  VERSION_FILE = $(obj)include/generated/version_autogenerated.h
881a87ecb   Wolfgang Denk   Add GIT version i...
34

7ebf7443a   wdenk   Initial revision
35
  HOSTARCH := $(shell uname -m | \
fea257200   Graeme Russ   x86: Rename i386 ...
36
  	sed -e s/i.86/x86/ \
7ebf7443a   wdenk   Initial revision
37
38
39
  	    -e s/sun4u/sparc64/ \
  	    -e s/arm.*/arm/ \
  	    -e s/sa110/arm/ \
d0179083a   Kumar Gala   Fixup native buil...
40
41
  	    -e s/ppc64/powerpc/ \
  	    -e s/ppc/powerpc/ \
8d1f63554   Nobuhiro Iwamatsu   sh: Fix build on ...
42
43
  	    -e s/macppc/powerpc/\
  	    -e s/sh.*/sh/)
7ebf7443a   wdenk   Initial revision
44

f9d77ed38   Wolfgang Denk   Make "tr" command...
45
  HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
7ebf7443a   wdenk   Initial revision
46
  	    sed -e 's/\(cygwin\).*/cygwin/')
cf7a7b997   Peter Tyser   Use bash for defa...
47
48
49
50
51
52
  # Set shell to bash if possible, otherwise fall back to sh
  SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  	else if [ -x /bin/bash ]; then echo /bin/bash; \
  	else echo sh; fi; fi)
  
  export	HOSTARCH HOSTOS SHELL
7ebf7443a   wdenk   Initial revision
53
54
55
56
57
  
  # Deal with colliding definitions from tcsh etc.
  VENDOR=
  
  #########################################################################
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
58
59
60
61
62
63
64
65
  # Allow for silent builds
  ifeq (,$(findstring s,$(MAKEFLAGS)))
  XECHO = echo
  else
  XECHO = :
  endif
  
  #########################################################################
f93286397   Marian Balakowicz   Add support for a...
66
67
68
  #
  # U-boot build supports producing a object files to the separate external
  # directory. Two use cases are supported:
887e2ec9e   Stefan Roese   Add support for A...
69
  #
f93286397   Marian Balakowicz   Add support for a...
70
71
72
73
74
75
76
77
78
79
  # 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'
887e2ec9e   Stefan Roese   Add support for A...
80
  #
f93286397   Marian Balakowicz   Add support for a...
81
  # Command line 'O=' setting overrides BUILD_DIR environent variable.
887e2ec9e   Stefan Roese   Add support for A...
82
  #
f93286397   Marian Balakowicz   Add support for a...
83
84
  # When none of the above methods is used the local build is performed and
  # the object files are placed in the source directory.
887e2ec9e   Stefan Roese   Add support for A...
85
  #
f93286397   Marian Balakowicz   Add support for a...
86
87
88
89
90
91
92
93
94
  
  ifdef O
  ifeq ("$(origin O)", "command line")
  BUILD_DIR := $(O)
  endif
  endif
  
  ifneq ($(BUILD_DIR),)
  saved-output := $(BUILD_DIR)
4f0645eb7   Marian Balakowicz   Fix LOG_DIR direc...
95
96
97
  
  # Attempt to create a output directory.
  $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
a73c8dbb4   Stefan Roese   Update NAND boot ...
98
  # Verify if it was successful.
f93286397   Marian Balakowicz   Add support for a...
99
100
101
102
103
  BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
  $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
  endif # ifneq ($(BUILD_DIR),)
  
  OBJTREE		:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
c8f9c302c   Daniel Schwierzeck   Extend build-syst...
104
  SPLTREE		:= $(OBJTREE)/spl
f93286397   Marian Balakowicz   Add support for a...
105
106
107
  SRCTREE		:= $(CURDIR)
  TOPDIR		:= $(SRCTREE)
  LNDIR		:= $(OBJTREE)
c8f9c302c   Daniel Schwierzeck   Extend build-syst...
108
  export	TOPDIR SRCTREE OBJTREE SPLTREE
f93286397   Marian Balakowicz   Add support for a...
109
110
111
  
  MKCONFIG	:= $(SRCTREE)/mkconfig
  export MKCONFIG
7ebf7443a   wdenk   Initial revision
112

f93286397   Marian Balakowicz   Add support for a...
113
  ifneq ($(OBJTREE),$(SRCTREE))
dd520bf31   Wolfgang Denk   Code cleanup.
114
  REMOTE_BUILD	:= 1
f93286397   Marian Balakowicz   Add support for a...
115
116
117
118
119
120
121
122
123
124
125
126
  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 :=
887e2ec9e   Stefan Roese   Add support for A...
127
  endif
f93286397   Marian Balakowicz   Add support for a...
128
  export obj src
5013c09f7   Wolfgang Denk   Makefile: cleanup...
129
130
  # Make sure CDPATH settings don't interfere
  unexport CDPATH
f93286397   Marian Balakowicz   Add support for a...
131
  #########################################################################
7ebf7443a   wdenk   Initial revision
132

6d1ce3878   Mike Frysinger   make sure topleve...
133
134
  # The "tools" are needed early, so put this first
  # Don't include stuff already done in $(LIBS)
349e83f07   Che-liang Chiou   examples: api: al...
135
136
137
138
139
  # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
  # is "yes"), so compile examples after U-Boot is compiled.
  SUBDIR_TOOLS = tools
  SUBDIR_EXAMPLES = examples/standalone examples/api
  SUBDIRS = $(SUBDIR_TOOLS)
6d1ce3878   Mike Frysinger   make sure topleve...
140

249b53a61   Loïc Minier   Build timestamp_a...
141
  .PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
6d1ce3878   Mike Frysinger   make sure topleve...
142

ae6d1056d   Wolfgang Denk   Fix Makefile depe...
143
  ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
7ebf7443a   wdenk   Initial revision
144

2632c008e   Mike Frysinger   autoconf.mk: incl...
145
146
147
148
149
150
  # Include autoconf.mk before config.mk so that the config options are available
  # to all top level build files.  We need the dummy all: target to prevent the
  # dependency target in autoconf.mk.dep from being the default.
  all:
  sinclude $(obj)include/autoconf.mk.dep
  sinclude $(obj)include/autoconf.mk
b5728756e   Simon Glass   sandbox: Adjust M...
151
152
153
  ifndef CONFIG_SANDBOX
  SUBDIRS += $(SUBDIR_EXAMPLES)
  endif
7ebf7443a   wdenk   Initial revision
154
  # load ARCH, BOARD, and CPU configuration
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
155
  include $(obj)include/config.mk
1d9f41050   wdenk   Patch by Steven S...
156
  export	ARCH CPU BOARD VENDOR SOC
f93286397   Marian Balakowicz   Add support for a...
157

1ea6bcd85   Mike Frysinger   push CROSS_COMPIL...
158
  # set default to nothing for native builds
a5284efd1   Wolfgang Denk   Fix HOSTARCH hand...
159
  ifeq ($(HOSTARCH),$(ARCH))
1ea6bcd85   Mike Frysinger   push CROSS_COMPIL...
160
  CROSS_COMPILE ?=
5c952cf02   wdenk   Patches by Scott ...
161
  endif
7ebf7443a   wdenk   Initial revision
162

92b197f0d   Wolfgang Denk   Fix Makefile: inc...
163
164
  # load other configuration
  include $(TOPDIR)/config.mk
d51dfff7a   Ilya Yanok   config.mk: move L...
165
166
167
  # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
  # that (or fail if absent).  Otherwise, search for a linker script in a
  # standard location.
ee60197e6   Simon Glass   Allow arch direct...
168
  LDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
d51dfff7a   Ilya Yanok   config.mk: move L...
169
170
171
172
173
174
175
  ifndef LDSCRIPT
  	#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
  	ifdef CONFIG_SYS_LDSCRIPT
  		# need to strip off double quotes
  		LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
  	endif
  endif
ee60197e6   Simon Glass   Allow arch direct...
176
  # If there is no specified link script, we look in a number of places for it
d51dfff7a   Ilya Yanok   config.mk: move L...
177
178
179
180
181
182
183
184
185
186
187
188
189
190
  ifndef LDSCRIPT
  	ifeq ($(CONFIG_NAND_U_BOOT),y)
  		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
  		ifeq ($(wildcard $(LDSCRIPT)),)
  			LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
  		endif
  	endif
  	ifeq ($(wildcard $(LDSCRIPT)),)
  		LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
  	endif
  	ifeq ($(wildcard $(LDSCRIPT)),)
  		LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
  	endif
  	ifeq ($(wildcard $(LDSCRIPT)),)
ee60197e6   Simon Glass   Allow arch direct...
191
192
193
194
195
  		LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
  		# We don't expect a Makefile here
  		LDSCRIPT_MAKEFILE_DIR =
  	endif
  	ifeq ($(wildcard $(LDSCRIPT)),)
d51dfff7a   Ilya Yanok   config.mk: move L...
196
197
198
  $(error could not find linker script)
  	endif
  endif
7ebf7443a   wdenk   Initial revision
199
200
  #########################################################################
  # U-Boot objects....order is important (i.e. start must be first)
03b7004dd   Peter Tyser   Create CPUDIR var...
201
  OBJS  = $(CPUDIR)/start.o
fea257200   Graeme Russ   x86: Rename i386 ...
202
  ifeq ($(CPU),x86)
03b7004dd   Peter Tyser   Create CPUDIR var...
203
204
  OBJS += $(CPUDIR)/start16.o
  OBJS += $(CPUDIR)/resetvec.o
2262cfeef   wdenk   * Patch by Daniel...
205
  endif
7ebf7443a   wdenk   Initial revision
206
  ifeq ($(CPU),ppc4xx)
03b7004dd   Peter Tyser   Create CPUDIR var...
207
  OBJS += $(CPUDIR)/resetvec.o
7ebf7443a   wdenk   Initial revision
208
  endif
42d1f0394   wdenk   * Patches by Xian...
209
  ifeq ($(CPU),mpc85xx)
03b7004dd   Peter Tyser   Create CPUDIR var...
210
  OBJS += $(CPUDIR)/resetvec.o
42d1f0394   wdenk   * Patches by Xian...
211
  endif
7ebf7443a   wdenk   Initial revision
212

f93286397   Marian Balakowicz   Add support for a...
213
  OBJS := $(addprefix $(obj),$(OBJS))
6d8962e81   Sebastien Carlier   Switch from archi...
214
215
216
  LIBS  = lib/libgeneric.o
  LIBS += lib/lzma/liblzma.o
  LIBS += lib/lzo/liblzo.o
e89516f03   Mike Frysinger   zlib: split up to...
217
  LIBS += lib/zlib/libz.o
5a4c59be8   Donghwa Lee   create lib/tizen ...
218
219
220
  ifeq ($(CONFIG_TIZEN),y)
  LIBS += lib/tizen/libtizen.o
  endif
7608d75f9   Kim Phillips   support board ven...
221
  LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
6d8962e81   Sebastien Carlier   Switch from archi...
222
223
  	"board/$(VENDOR)/common/lib$(VENDOR).o"; fi)
  LIBS += $(CPUDIR)/lib$(CPU).o
1d9f41050   wdenk   Patch by Steven S...
224
  ifdef SOC
6d8962e81   Sebastien Carlier   Switch from archi...
225
  LIBS += $(CPUDIR)/$(SOC)/lib$(SOC).o
1d9f41050   wdenk   Patch by Steven S...
226
  endif
323bfa8f4   Stefan Roese   Remove BOARDLIBS ...
227
  ifeq ($(CPU),ixp)
6d8962e81   Sebastien Carlier   Switch from archi...
228
  LIBS += arch/arm/cpu/ixp/npe/libnpe.o
323bfa8f4   Stefan Roese   Remove BOARDLIBS ...
229
  endif
bbb0b128c   Simon Glass   fdt: Add support ...
230
231
232
  ifeq ($(CONFIG_OF_EMBED),y)
  LIBS += dts/libdts.o
  endif
6d8962e81   Sebastien Carlier   Switch from archi...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
  LIBS += arch/$(ARCH)/lib/lib$(ARCH).o
  LIBS += fs/cramfs/libcramfs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o \
  	fs/reiserfs/libreiserfs.o fs/ext2/libext2fs.o fs/yaffs2/libyaffs2.o \
  	fs/ubifs/libubifs.o
  LIBS += net/libnet.o
  LIBS += disk/libdisk.o
  LIBS += drivers/bios_emulator/libatibiosemu.o
  LIBS += drivers/block/libblock.o
  LIBS += drivers/dma/libdma.o
  LIBS += drivers/fpga/libfpga.o
  LIBS += drivers/gpio/libgpio.o
  LIBS += drivers/hwmon/libhwmon.o
  LIBS += drivers/i2c/libi2c.o
  LIBS += drivers/input/libinput.o
  LIBS += drivers/misc/libmisc.o
  LIBS += drivers/mmc/libmmc.o
  LIBS += drivers/mtd/libmtd.o
  LIBS += drivers/mtd/nand/libnand.o
  LIBS += drivers/mtd/onenand/libonenand.o
  LIBS += drivers/mtd/ubi/libubi.o
  LIBS += drivers/mtd/spi/libspi_flash.o
  LIBS += drivers/net/libnet.o
  LIBS += drivers/net/phy/libphy.o
  LIBS += drivers/pci/libpci.o
  LIBS += drivers/pcmcia/libpcmcia.o
  LIBS += drivers/power/libpower.o
  LIBS += drivers/spi/libspi.o
7737d5c65   Dave Liu   mpc83xx: add QE e...
260
  ifeq ($(CPU),mpc83xx)
6d8962e81   Sebastien Carlier   Switch from archi...
261
  LIBS += drivers/qe/libqe.o
d29d17d7b   York Sun   powerpc/mpc83xx: ...
262
  LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
6d8962e81   Sebastien Carlier   Switch from archi...
263
  LIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
7737d5c65   Dave Liu   mpc83xx: add QE e...
264
  endif
da9d4610d   Andy Fleming   Add support for U...
265
  ifeq ($(CPU),mpc85xx)
6d8962e81   Sebastien Carlier   Switch from archi...
266
  LIBS += drivers/qe/libqe.o
c916d7c91   Kumar Gala   powerpc/85xx: Add...
267
  LIBS += drivers/net/fm/libfm.o
6d8962e81   Sebastien Carlier   Switch from archi...
268
269
  LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
  LIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
58e5e9aff   Kumar Gala   FSL DDR: Rewrite ...
270
271
  endif
  ifeq ($(CPU),mpc86xx)
6d8962e81   Sebastien Carlier   Switch from archi...
272
273
  LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
  LIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
da9d4610d   Andy Fleming   Add support for U...
274
  endif
6d8962e81   Sebastien Carlier   Switch from archi...
275
276
  LIBS += drivers/rtc/librtc.o
  LIBS += drivers/serial/libserial.o
5e1247247   Vadim Bendebury   Introduce generic...
277
278
279
  ifeq ($(CONFIG_GENERIC_LPC_TPM),y)
  LIBS += drivers/tpm/libtpm.o
  endif
6d8962e81   Sebastien Carlier   Switch from archi...
280
  LIBS += drivers/twserial/libtws.o
181f565c2   Mike Frysinger   usb: convert to p...
281
  LIBS += drivers/usb/eth/libusb_eth.o
6d8962e81   Sebastien Carlier   Switch from archi...
282
283
284
285
  LIBS += drivers/usb/gadget/libusb_gadget.o
  LIBS += drivers/usb/host/libusb_host.o
  LIBS += drivers/usb/musb/libusb_musb.o
  LIBS += drivers/usb/phy/libusb_phy.o
f93022c3b   Jana Rapava   USB: Add generic ...
286
  LIBS += drivers/usb/ulpi/libusb_ulpi.o
6d8962e81   Sebastien Carlier   Switch from archi...
287
288
289
290
291
292
  LIBS += drivers/video/libvideo.o
  LIBS += drivers/watchdog/libwatchdog.o
  LIBS += common/libcommon.o
  LIBS += lib/libfdt/libfdt.o
  LIBS += api/libapi.o
  LIBS += post/libpost.o
f93286397   Marian Balakowicz   Add support for a...
293

f16da7466   Chandan Nath   ARM:AM33XX: Repla...
294
  ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
f0f4b5ff5   Chandan Nath   ARM:AM33XX: Added...
295
296
  LIBS += $(CPUDIR)/omap-common/libomap-common.o
  endif
18936ee2a   Jason Liu   i.mx: introduce t...
297
298
299
300
301
302
303
  
  ifeq ($(SOC),mx5)
  LIBS += $(CPUDIR)/imx-common/libimx-common.o
  endif
  ifeq ($(SOC),mx6)
  LIBS += $(CPUDIR)/imx-common/libimx-common.o
  endif
852bd07c8   Minkyu Kang   ARMV7: S5P: make ...
304
  ifeq ($(SOC),s5pc1xx)
6d8962e81   Sebastien Carlier   Switch from archi...
305
  LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
852bd07c8   Minkyu Kang   ARMV7: S5P: make ...
306
  endif
393cb3619   Chander Kashyap   S5PC2XX: Rename S...
307
  ifeq ($(SOC),exynos)
6d8962e81   Sebastien Carlier   Switch from archi...
308
  LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
852bd07c8   Minkyu Kang   ARMV7: S5P: make ...
309
  endif
566d49a3f   Wolfgang Denk   512x: Cleanup for...
310
  LIBS := $(addprefix $(obj),$(sort $(LIBS)))
249b53a61   Loïc Minier   Build timestamp_a...
311
  .PHONY : $(LIBS)
a8c7c708a   wdenk   * Patch by Gleb N...
312

6d8962e81   Sebastien Carlier   Switch from archi...
313
  LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o
de109d909   Wolfgang Denk   Makefile: fix par...
314
  LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
4f7cb08ee   wdenk   * Patch by Martin...
315
  # Add GCC lib
52b1bf2c5   Wolfgang Denk   Make linking agai...
316
317
  ifdef USE_PRIVATE_LIBGCC
  ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
635d1b3e1   Matthias Weisser   Makefile: Fix bui...
318
  PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
52b1bf2c5   Wolfgang Denk   Make linking agai...
319
320
321
322
  else
  PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
  endif
  else
cca4e4aec   Wolfgang Denk   Reduce build times
323
  PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
52b1bf2c5   Wolfgang Denk   Make linking agai...
324
325
326
  endif
  PLATFORM_LIBS += $(PLATFORM_LIBGCC)
  export PLATFORM_LIBS
3d3befa75   wdenk   * Patch by Philip...
327

6ac9f4797   Mike Frysinger   start a linker sc...
328
329
330
331
332
  # Special flags for CPP when processing the linker script.
  # Pass the version down so we can handle backwards compatibility
  # on the fly.
  LDPPFLAGS += \
  	-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
7e6403a66   Simon Glass   Define CPUDIR for...
333
  	-DCPUDIR=$(CPUDIR) \
6ac9f4797   Mike Frysinger   start a linker sc...
334
335
  	$(shell $(LD) --version | \
  	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
f93286397   Marian Balakowicz   Add support for a...
336
  __OBJS := $(subst $(obj),,$(OBJS))
de109d909   Wolfgang Denk   Makefile: fix par...
337
  __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
f93286397   Marian Balakowicz   Add support for a...
338

7ebf7443a   wdenk   Initial revision
339
  #########################################################################
bdccc4fed   wdenk   * Map ISP1362 USB...
340
  #########################################################################
7ebf7443a   wdenk   Initial revision
341

f3a14d377   Mike Frysinger   Makefile: allow b...
342
343
344
345
346
347
348
349
350
351
352
353
354
355
  ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
  BOARD_SIZE_CHECK = \
  	@actual=`wc -c $@ | awk '{print $$1}'`; \
  	limit=$(CONFIG_BOARD_SIZE_LIMIT); \
  	if test $$actual -gt $$limit; then \
  		echo "$@ exceeds file size limit:"; \
  		echo "  limit:  $$limit bytes"; \
  		echo "  actual: $$actual bytes"; \
  		echo "  excess: $$((actual - limit)) bytes"; \
  		exit 1; \
  	fi
  else
  BOARD_SIZE_CHECK =
  endif
3e88337b2   Mike Frysinger   Blackfin: move AL...
356
  # Always append ALL so that arch config.mk's can add custom ones
4e0fbb98f   Daniel Schwierzeck   Use ALL-y style i...
357
  ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
e935a374d   Haiying Wang   Fix NAND_SPL and ...
358

4e0fbb98f   Daniel Schwierzeck   Use ALL-y style i...
359
360
  ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
  ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
e935a374d   Haiying Wang   Fix NAND_SPL and ...
361
  ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
5df2ee27d   Daniel Schwierzeck   Hook SPL build-sy...
362
  ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
2c0f79e44   Simon Glass   fdt: Add support ...
363
  ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
0d3c62e46   Chander Kashyap   ARMV7: MMC SPL Bo...
364

349e83f07   Che-liang Chiou   examples: api: al...
365
  all:		$(ALL-y) $(SUBDIR_EXAMPLES)
7ebf7443a   wdenk   Initial revision
366

2c0f79e44   Simon Glass   fdt: Add support ...
367
368
369
370
371
372
  $(obj)u-boot.dtb:	$(obj)u-boot
  		$(MAKE) -C dts binary
  		mv $(obj)dts/dt.dtb $@
  
  $(obj)u-boot-dtb.bin:	$(obj)u-boot.bin $(obj)u-boot.dtb
  		cat $^ >$@
f93286397   Marian Balakowicz   Add support for a...
373
  $(obj)u-boot.hex:	$(obj)u-boot
6310eb9da   wdenk   Patches by David ...
374
  		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
f93286397   Marian Balakowicz   Add support for a...
375
  $(obj)u-boot.srec:	$(obj)u-boot
0817d688f   Ricardo Ribalda Delgado   Remove gap fill i...
376
  		$(OBJCOPY) -O srec $< $@
7ebf7443a   wdenk   Initial revision
377

f93286397   Marian Balakowicz   Add support for a...
378
  $(obj)u-boot.bin:	$(obj)u-boot
7ebf7443a   wdenk   Initial revision
379
  		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
f3a14d377   Mike Frysinger   Makefile: allow b...
380
  		$(BOARD_SIZE_CHECK)
7ebf7443a   wdenk   Initial revision
381

94a91e248   Mike Frysinger   generate u-boot.l...
382
  $(obj)u-boot.ldr:	$(obj)u-boot
76d82187c   Mike Frysinger   Blackfin: tweak e...
383
  		$(CREATE_LDR_ENV)
68e563249   Mike Frysinger   Blackfin: dont ge...
384
  		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
f3a14d377   Mike Frysinger   Makefile: allow b...
385
  		$(BOARD_SIZE_CHECK)
94a91e248   Mike Frysinger   generate u-boot.l...
386
387
388
389
390
391
  
  $(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
  		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
  
  $(obj)u-boot.ldr.srec:	$(obj)u-boot.ldr
  		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
f93286397   Marian Balakowicz   Add support for a...
392
  $(obj)u-boot.img:	$(obj)u-boot.bin
a2a0a7171   Wolfgang Denk   Makefile: fix out...
393
  		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
3857f8f5a   aneeshv   Correct ih_os for...
394
  		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) -e 0 \
881a87ecb   Wolfgang Denk   Add GIT version i...
395
  		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
bdccc4fed   wdenk   * Map ISP1362 USB...
396
397
  			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
  		-d $< $@
8edcde5e4   Stefano Babic   mkimage: Add Free...
398
  $(obj)u-boot.imx:       $(obj)u-boot.bin
45d7d72b0   Stefano Babic   Makefile: change ...
399
  		$(obj)tools/mkimage -n  $(CONFIG_IMX_CONFIG) -T imximage \
14d0a02a1   Wolfgang Denk   Rename TEXT_BASE ...
400
  		-e $(CONFIG_SYS_TEXT_BASE) -d $< $@
8edcde5e4   Stefano Babic   mkimage: Add Free...
401

aa0c7a86c   Prafulla Wadaskar   mkimage: Add Kirk...
402
  $(obj)u-boot.kwb:       $(obj)u-boot.bin
31d80c77f   Prafulla Wadaskar   kirkwood: get rid...
403
  		$(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
2ea88b063   Eric Cooper   Makefile: rename ...
404
  		-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
aa0c7a86c   Prafulla Wadaskar   mkimage: Add Kirk...
405

566a494f5   Heiko Schocher   [PCS440EP] u...
406
  $(obj)u-boot.sha1:	$(obj)u-boot.bin
011595307   Heiko Schocher   [PCS440EP] - fix...
407
  		$(obj)tools/ubsha1 $(obj)u-boot.bin
566a494f5   Heiko Schocher   [PCS440EP] u...
408

f93286397   Marian Balakowicz   Add support for a...
409
  $(obj)u-boot.dis:	$(obj)u-boot
7ebf7443a   wdenk   Initial revision
410
  		$(OBJDUMP) -d $< > $@
435199f38   Heiko Schocher   arm, davinci: add...
411
412
413
  $(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
  		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin
7816f2cf8   Heiko Schocher   mkimage: add UBL ...
414
  		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
435199f38   Heiko Schocher   arm, davinci: add...
415
416
417
  		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl
  		rm $(obj)u-boot-ubl.bin
  		rm $(obj)spl/u-boot-spl-pad.bin
7816f2cf8   Heiko Schocher   mkimage: add UBL ...
418

d36d88598   Christian Riesch   arm, davinci: Add...
419
420
421
422
423
424
425
426
427
428
429
  $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  		$(obj)tools/mkimage -s -n /dev/null -T aisimage \
  			-e $(CONFIG_SPL_TEXT_BASE) \
  			-d $(obj)spl/u-boot-spl.bin \
  			$(obj)spl/u-boot-spl.ais
  		$(OBJCOPY) ${OBJCFLAGS} -I binary \
  			--pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
  			$(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
  		cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.bin > \
  			$(obj)u-boot.ais
  		rm $(obj)spl/u-boot-spl{,-pad}.ais
30b9b932a   Marek Vasut   iMX28: Add u-boot...
430
431
432
  $(obj)u-boot.sb:       $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
  		elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \
  			-o $(obj)u-boot.sb
86eb49b3e   Simon Glass   sandbox: Makefile...
433
434
435
436
437
438
  ifeq ($(CONFIG_SANDBOX),y)
  GEN_UBOOT = \
  		cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
  			-Wl,--start-group $(__LIBS) -Wl,--end-group \
  			$(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
  else
ecb1dc892   Mike Frysinger   Add support for L...
439
  GEN_UBOOT = \
de109d909   Wolfgang Denk   Makefile: fix par...
440
441
  		UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
  		sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
8aba9dcee   Nobuhiro Iwamatsu   Divides variable ...
442
  		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__OBJS) \
f93286397   Marian Balakowicz   Add support for a...
443
  			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
b2184c314   wdenk   * Patch by Daniel...
444
  			-Map u-boot.map -o u-boot
86eb49b3e   Simon Glass   sandbox: Makefile...
445
  endif
16a354f92   Wolfgang Denk   include/asm-offse...
446
  $(obj)u-boot:	depend \
349e83f07   Che-liang Chiou   examples: api: al...
447
  		$(SUBDIR_TOOLS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
ecb1dc892   Mike Frysinger   Add support for L...
448
449
  		$(GEN_UBOOT)
  ifeq ($(CONFIG_KALLSYMS),y)
1aada9cd6   Wolfgang Denk   Fix all linker sc...
450
451
452
453
  		smap=`$(call SYSTEM_MAP,u-boot) | \
  			awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
  		$(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
  			-c common/system_map.c -o $(obj)common/system_map.o
ecb1dc892   Mike Frysinger   Add support for L...
454
455
  		$(GEN_UBOOT) $(obj)common/system_map.o
  endif
7ebf7443a   wdenk   Initial revision
456

d0d6144e0   Peter Tyser   Makefile: Make au...
457
  $(OBJS):	depend
03b7004dd   Peter Tyser   Create CPUDIR var...
458
  		$(MAKE) -C $(CPUDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@))
f93286397   Marian Balakowicz   Add support for a...
459

349e83f07   Che-liang Chiou   examples: api: al...
460
  $(LIBS):	depend $(SUBDIR_TOOLS)
f93286397   Marian Balakowicz   Add support for a...
461
  		$(MAKE) -C $(dir $(subst $(obj),,$@))
a8c7c708a   wdenk   * Patch by Gleb N...
462

d0d6144e0   Peter Tyser   Makefile: Make au...
463
  $(LIBBOARD):	depend $(LIBS)
de109d909   Wolfgang Denk   Makefile: fix par...
464
  		$(MAKE) -C $(dir $(subst $(obj),,$@))
d0d6144e0   Peter Tyser   Makefile: Make au...
465
  $(SUBDIRS):	depend
b028f7151   wdenk   * Patch by Yuli B...
466
  		$(MAKE) -C $@ all
7ebf7443a   wdenk   Initial revision
467

349e83f07   Che-liang Chiou   examples: api: al...
468
  $(SUBDIR_EXAMPLES): $(obj)u-boot
d0d6144e0   Peter Tyser   Makefile: Make au...
469
  $(LDSCRIPT):	depend
f65c98129   Mike Frysinger   Makefile: add tar...
470
  		$(MAKE) -C $(dir $@) $(notdir $@)
1aada9cd6   Wolfgang Denk   Fix all linker sc...
471
472
  $(obj)u-boot.lds: $(LDSCRIPT)
  		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
e935a374d   Haiying Wang   Fix NAND_SPL and ...
473
  nand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
8318fbf8c   Marian Balakowicz   Fix sequoia separ...
474
  		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
887e2ec9e   Stefan Roese   Add support for A...
475

e935a374d   Haiying Wang   Fix NAND_SPL and ...
476
  $(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
8318fbf8c   Marian Balakowicz   Fix sequoia separ...
477
  		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
887e2ec9e   Stefan Roese   Add support for A...
478

e935a374d   Haiying Wang   Fix NAND_SPL and ...
479
  onenand_ipl:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
f2302d443   Stefan Roese   Fix merge problems
480
  		$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
751b9b518   Kyungmin Park   OneNAND Initial P...
481

e935a374d   Haiying Wang   Fix NAND_SPL and ...
482
  $(obj)u-boot-onenand.bin:	onenand_ipl $(obj)u-boot.bin
ca6189db4   Kyungmin Park   Refactor OneNAND ...
483
  		cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
751b9b518   Kyungmin Park   OneNAND Initial P...
484

bd25fdba4   Aneesh V   Makefile: Add the...
485
  $(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
5df2ee27d   Daniel Schwierzeck   Hook SPL build-sy...
486
  		$(MAKE) -C spl all
f93286397   Marian Balakowicz   Add support for a...
487
  updater:
0358df427   Mike Frysinger   unify toplevel to...
488
  		$(MAKE) -C tools/updater all
8f713fdfe   dzu   Removed tools/gdb...
489

2a9987935   Daniel Hobi   Makefile: fix par...
490
491
  # Explicitly make _depend in subdirs containing multiple targets to prevent
  # parallel sub-makes creating .depend files simultaneously.
16a354f92   Wolfgang Denk   include/asm-offse...
492
493
  depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
  		$(obj)include/autoconf.mk \
a4814a69d   Stefano Babic   Makefile : fix ge...
494
495
  		$(obj)include/generated/generic-asm-offsets.h \
  		$(obj)include/generated/asm-offsets.h
ee60197e6   Simon Glass   Allow arch direct...
496
  		for dir in $(SUBDIRS) $(CPUDIR) $(LDSCRIPT_MAKEFILE_DIR) ; do \
2a9987935   Daniel Hobi   Makefile: fix par...
497
  			$(MAKE) -C $$dir _depend ; done
7ebf7443a   wdenk   Initial revision
498

e5e4e705c   Li Yang   Update Makefile f...
499
500
  TAG_SUBDIRS = $(SUBDIRS)
  TAG_SUBDIRS += $(dir $(__LIBS))
a340c325e   Jean-Christophe PLAGNIOL-VILLARD   Makefile : fix ta...
501
  TAG_SUBDIRS += include
a340c325e   Jean-Christophe PLAGNIOL-VILLARD   Makefile : fix ta...
502

857d9ea67   Horst Kronstorfer   Let source cross-...
503
504
  FIND := find
  FINDFLAGS := -L
1064d980b   Tom Rini   tools: checkstack...
505
506
507
508
  checkstack:
  		$(CROSS_COMPILE)objdump -d $(obj)u-boot \
  			`$(FIND) $(obj) -name u-boot-spl -print` | \
  			perl $(src)tools/checkstack.pl $(ARCH)
f93286397   Marian Balakowicz   Add support for a...
509
  tags ctags:
857d9ea67   Horst Kronstorfer   Let source cross-...
510
  		ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
e5e4e705c   Li Yang   Update Makefile f...
511
  						-name '*.[chS]' -print`
7ebf7443a   wdenk   Initial revision
512
513
  
  etags:
857d9ea67   Horst Kronstorfer   Let source cross-...
514
  		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
e5e4e705c   Li Yang   Update Makefile f...
515
  						-name '*.[chS]' -print`
ffda586fc   Li Yang   add cscope build ...
516
  cscope:
857d9ea67   Horst Kronstorfer   Let source cross-...
517
518
  		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
  						cscope.files
ffda586fc   Li Yang   add cscope build ...
519
  		cscope -b -q -k
7ebf7443a   wdenk   Initial revision
520

ecb1dc892   Mike Frysinger   Add support for L...
521
522
  SYSTEM_MAP = \
  		$(NM) $1 | \
7ebf7443a   wdenk   Initial revision
523
  		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
ecb1dc892   Mike Frysinger   Add support for L...
524
525
526
  		LC_ALL=C sort
  $(obj)System.map:	$(obj)u-boot
  		@$(call SYSTEM_MAP,$<) > $(obj)System.map
7ebf7443a   wdenk   Initial revision
527

06a119a03   Tom Rini   Makefile: Add a '...
528
529
530
531
532
533
534
  checkthumb:
  	@if test $(call cc-version) -lt 0404; then \
  		echo -n '*** Your GCC does not produce working '; \
  		echo 'binaries in THUMB mode.'; \
  		echo '*** Your board is configured for THUMB mode.'; \
  		false; \
  	fi
2f155f6c0   Grant Likely   [BUILD] Generate ...
535
536
537
538
539
540
  #
  # Auto-generate the autoconf.mk file (which is included by all makefiles)
  #
  # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
  # the dep file is only include in this top level makefile to determine when
  # to regenerate the autoconf.mk file.
1510b82d5   Wolfgang Denk   Makefile: fix "er...
541
542
  $(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
  	@$(XECHO) Generating $@ ; \
16fe77752   Mike Frysinger   error check autoc...
543
  	set -e ; \
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
544
  	: Generate the dependancies ; \
4c34b2a09   Mike Frysinger   autoconf.mk.dep: ...
545
  	$(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
1510b82d5   Wolfgang Denk   Makefile: fix "er...
546
547
548
549
550
  		-MQ $(obj)include/autoconf.mk include/common.h > $@
  
  $(obj)include/autoconf.mk: $(obj)include/config.h
  	@$(XECHO) Generating $@ ; \
  	set -e ; \
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
551
  	: Extract the config macros ; \
1510b82d5   Wolfgang Denk   Makefile: fix "er...
552
  	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
4a0f7538c   Wolfgang Denk   Makefile: fix dep...
553
554
  		sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
  	mv $@.tmp $@
2f155f6c0   Grant Likely   [BUILD] Generate ...
555

16a354f92   Wolfgang Denk   include/asm-offse...
556
557
558
559
560
561
562
563
564
565
566
  $(obj)include/generated/generic-asm-offsets.h:	$(obj)include/autoconf.mk.dep \
  	$(obj)lib/asm-offsets.s
  	@$(XECHO) Generating $@
  	tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
  
  $(obj)lib/asm-offsets.s:	$(obj)include/autoconf.mk.dep \
  	$(src)lib/asm-offsets.c
  	@mkdir -p $(obj)lib
  	$(CC) -DDO_DEPS_ONLY \
  		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  		-o $@ $(src)lib/asm-offsets.c -c -S
a4814a69d   Stefano Babic   Makefile : fix ge...
567
568
569
570
571
572
573
574
575
576
577
578
579
580
  $(obj)include/generated/asm-offsets.h:	$(obj)include/autoconf.mk.dep \
  	$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
  	@echo Generating $@
  	tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
  
  $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s:	$(obj)include/autoconf.mk.dep
  	@mkdir -p $(obj)$(CPUDIR)/$(SOC)
  	if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
  		$(CC) -DDO_DEPS_ONLY \
  		$(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  			-o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
  	else \
  		touch $@; \
  	fi
7ebf7443a   wdenk   Initial revision
581
  #########################################################################
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
582
  else	# !config.mk
f93286397   Marian Balakowicz   Add support for a...
583
584
  all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
  $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
249b53a61   Loïc Minier   Build timestamp_a...
585
  $(filter-out tools,$(SUBDIRS)) \
0358df427   Mike Frysinger   unify toplevel to...
586
  updater depend dep tags ctags etags cscope $(obj)System.map:
7ebf7443a   wdenk   Initial revision
587
588
  	@echo "System not configured - see README" >&2
  	@ exit 1
c7c0d542a   Mike Frysinger   tools: allow peop...
589

249b53a61   Loïc Minier   Build timestamp_a...
590
  tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
0358df427   Mike Frysinger   unify toplevel to...
591
  	$(MAKE) -C $@ all
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
592
  endif	# config.mk
7ebf7443a   wdenk   Initial revision
593

28abd48f5   Ilya Yanok   Makefile: move $(...
594
  $(VERSION_FILE):
14ce91b11   Mike Frysinger   fix unconfigured ...
595
  		@mkdir -p $(dir $(VERSION_FILE))
28abd48f5   Ilya Yanok   Makefile: move $(...
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
  		@( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
  		   printf '#define PLAIN_VERSION "%s%s"
  ' \
  			"$(U_BOOT_VERSION)" "$${localvers}" ; \
  		   printf '#define U_BOOT_VERSION "U-Boot %s%s"
  ' \
  			"$(U_BOOT_VERSION)" "$${localvers}" ; \
  		) > $@.tmp
  		@( printf '#define CC_VERSION_STRING "%s"
  ' \
  		 '$(shell $(CC) --version | head -n 1)' )>>  $@.tmp
  		@( printf '#define LD_VERSION_STRING "%s"
  ' \
  		 '$(shell $(LD) -v | head -n 1)' )>>  $@.tmp
  		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
249b53a61   Loïc Minier   Build timestamp_a...
611
612
  $(TIMESTAMP_FILE):
  		@mkdir -p $(dir $(TIMESTAMP_FILE))
a76406fb0   Loïc Minier   Safer timestamp_a...
613
614
615
  		@LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
  		@LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
  		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
249b53a61   Loïc Minier   Build timestamp_a...
616

0358df427   Mike Frysinger   unify toplevel to...
617
618
619
  easylogo env gdb:
  	$(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION}
  gdbtools: gdb
249b53a61   Loïc Minier   Build timestamp_a...
620
  tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
0358df427   Mike Frysinger   unify toplevel to...
621
  	$(MAKE) -C tools HOST_TOOLS_ALL=y
4e53a2585   Wolfgang Denk   Fix Makefile for ...
622
623
  .PHONY : CHANGELOG
  CHANGELOG:
b985b5d6e   Ben Warren   Fix TSEC driver: ...
624
625
  	git log --no-merges U-Boot-1_1_5.. | \
  	unexpand -a | sed -e 's/\s\s*$$//' > $@
4e53a2585   Wolfgang Denk   Fix Makefile for ...
626

0a823aa2a   Harald Welte   Add 'license' com...
627
  include/license.h: tools/bin2header COPYING
0e42ada31   Wolfgang Denk   Fix printing of m...
628
  	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
7ebf7443a   wdenk   Initial revision
629
630
631
  #########################################################################
  
  unconfig:
887e2ec9e   Stefan Roese   Add support for A...
632
  	@rm -f $(obj)include/config.h $(obj)include/config.mk \
2f155f6c0   Grant Likely   [BUILD] Generate ...
633
634
  		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
  		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
7ebf7443a   wdenk   Initial revision
635

a6862bc12   Wolfgang Denk   Makefile/mkconfig...
636
637
  %_config::	unconfig
  	@$(MKCONFIG) -A $(@:_config=)
d6a5e6d53   Loïc Minier   Cleanup .boards.d...
638
639
  sinclude $(obj).boards.depend
  $(obj).boards.depend:	boards.cfg
37d0e7777   Lauri Hintsala   Makefile: fix dis...
640
  	@awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@
9f4a42066   Mike Frysinger   new default short...
641

8c994630b   Wolfgang Denk   Makefile: simplif...
642
643
644
645
646
  #
  # Functions to generate common board directory names
  #
  lcname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
  ucname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
7ebf7443a   wdenk   Initial revision
647
648
649
  #========================================================================
  # ARM
  #========================================================================
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
650

47fd3bffe   Jean-Christophe PLAGNIOL-VILLARD   SX1: add CONFIG_S...
651
652
653
654
655
  SX1_stdout_serial_config \
  SX1_config:		unconfig
  	@mkdir -p $(obj)include
  	@if [ "$(findstring _stdout_serial_, $@)" ] ; then \
  		echo "#undef CONFIG_STDOUT_USBTTY" >> $(obj)include/config.h ; \
47fd3bffe   Jean-Christophe PLAGNIOL-VILLARD   SX1: add CONFIG_S...
656
657
  	else \
  		echo "#define CONFIG_STDOUT_USBTTY" >> $(obj)include/config.h ; \
47fd3bffe   Jean-Christophe PLAGNIOL-VILLARD   SX1: add CONFIG_S...
658
  	fi;
0e42ada31   Wolfgang Denk   Fix printing of m...
659
  	@$(MKCONFIG) -n $@ SX1 arm arm925t sx1
2d24a3a78   wdenk   * Patch by Yuli B...
660

699f05125   Wolfgang Denk   Prepare v1.3.4-rc...
661
  #########################################################################
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
662
663
664
665
666
667
668
  ## ARM1176 Systems
  #########################################################################
  smdk6400_noUSB_config	\
  smdk6400_config	:	unconfig
  	@mkdir -p $(obj)include $(obj)board/samsung/smdk6400
  	@mkdir -p $(obj)nand_spl/board/samsung/smdk6400
  	@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
0e42ada31   Wolfgang Denk   Fix printing of m...
669
  	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
670
671
  	@if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then			\
  		echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
672
673
  	else										\
  		echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
674
  	fi
54e19a7de   Wolfgang Denk   Merge branch 'mas...
675
  	@$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
676
  	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
0afe519a4   Wolfgang Denk   Add ADI Blackfin ...
677
  #########################################################################
3e38691e8   wdenk   * Patch by Arun D...
678
  #########################################################################
7ebf7443a   wdenk   Initial revision
679
680
  
  clean:
1bc153861   Peter Tyser   Move examples/ to...
681
  	@rm -f $(obj)examples/standalone/82559_eeprom			  \
d640ac58d   Wolfgang Denk   Remove "atmel_df_...
682
  	       $(obj)examples/standalone/atmel_df_pow2			  \
1bc153861   Peter Tyser   Move examples/ to...
683
684
685
686
687
  	       $(obj)examples/standalone/eepro100_eeprom		  \
  	       $(obj)examples/standalone/hello_world			  \
  	       $(obj)examples/standalone/interrupt			  \
  	       $(obj)examples/standalone/mem_to_mem_idma2intr		  \
  	       $(obj)examples/standalone/sched				  \
201a017c2   Mike Frysinger   examples: add smc...
688
  	       $(obj)examples/standalone/smc911{11,x}_eeprom		  \
1bc153861   Peter Tyser   Move examples/ to...
689
690
  	       $(obj)examples/standalone/test_burst			  \
  	       $(obj)examples/standalone/timer
d4abc757c   Peter Tyser   Move api_examples...
691
  	@rm -f $(obj)examples/api/demo{,.bin}
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
692
693
694
695
696
  	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
  	       $(obj)tools/env/{fw_printenv,fw_setenv}			  \
  	       $(obj)tools/envcrc					  \
  	       $(obj)tools/gdb/{astest,gdbcont,gdbsend}			  \
  	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
7717fe10b   Horst Kronstorfer   Makefile: add too...
697
  	       $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk	  \
81e352032   Chander Kashyap   EXYNOS: SMDK5250:...
698
  	       $(obj)tools/mk{smdk5250,}spl				  \
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
699
700
  	       $(obj)tools/ncb		   $(obj)tools/ubsha1
  	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
74c7a95f2   Wolfgang Denk   Makefile: clean M...
701
  	       $(obj)board/matrix_vision/*/bootscript.img		  \
566e5cf45   Wolfgang Denk   ARM: drop unsuppo...
702
  	       $(obj)board/voiceblue/eeprom 				  \
1aada9cd6   Wolfgang Denk   Fix all linker sc...
703
  	       $(obj)u-boot.lds						  \
fb5166ce3   Mike Frysinger   Blackfin: add ini...
704
705
  	       $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]	  \
  	       $(obj)arch/blackfin/cpu/init.{lds,elf}
dc7746d86   Wolfgang Denk   Makefile: remove ...
706
  	@rm -f $(obj)include/bmp_logo.h
c270730f5   Che-Liang Chiou   tools: logo: spli...
707
  	@rm -f $(obj)include/bmp_logo_data.h
16a354f92   Wolfgang Denk   include/asm-offse...
708
  	@rm -f $(obj)lib/asm-offsets.s
a4814a69d   Stefano Babic   Makefile : fix ge...
709
710
  	@rm -f $(obj)include/generated/asm-offsets.h
  	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
ff6b47ad2   Kumar Gala   Makefile: need to...
711
  	@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
ca6189db4   Kyungmin Park   Refactor OneNAND ...
712
713
  	@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
  	@rm -f $(ONENAND_BIN)
1aada9cd6   Wolfgang Denk   Fix all linker sc...
714
  	@rm -f $(obj)onenand_ipl/u-boot.lds
5df2ee27d   Daniel Schwierzeck   Hook SPL build-sy...
715
  	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.lds,u-boot-spl.map}
4e4b21bd4   Joel A Fernandes   Makefile: Remove ...
716
  	@rm -f $(obj)MLO
d4abc757c   Peter Tyser   Move api_examples...
717
  	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
718
  	@find $(OBJTREE) -type f \
4a30f1e87   Tom Rini   config.mk: Check ...
719
  		\( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
2b48f7d5f   Peter Tyser   Makefile: Add rem...
720
  		-o -name '*.o'	-o -name '*.a' -o -name '*.exe'	\) -print \
7ebf7443a   wdenk   Initial revision
721
  		| xargs rm -f
7ebf7443a   wdenk   Initial revision
722

734329f96   Andy Fleming   Add a "tidy" buil...
723
724
725
726
727
728
729
730
  # Removes everything not needed for testing u-boot
  tidy:	clean
  	@find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
  
  clobber:	tidy
  	@find $(OBJTREE) -type f \( -name '*.srec' \
  		-o -name '*.bin' -o -name u-boot.img \) \
  		-print0 | xargs -0 rm -f
ffda586fc   Li Yang   add cscope build ...
731
  	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
5013c09f7   Wolfgang Denk   Makefile: cleanup...
732
  		$(obj)cscope.* $(obj)*.*~
4e0fbb98f   Daniel Schwierzeck   Use ALL-y style i...
733
  	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
aa0c7a86c   Prafulla Wadaskar   mkimage: Add Kirk...
734
  	@rm -f $(obj)u-boot.kwb
c5fb70c91   Stefano Babic   Add initial suppo...
735
  	@rm -f $(obj)u-boot.imx
7816f2cf8   Heiko Schocher   mkimage: add UBL ...
736
  	@rm -f $(obj)u-boot.ubl
d36d88598   Christian Riesch   arm, davinci: Add...
737
  	@rm -f $(obj)u-boot.ais
bbb0b128c   Simon Glass   fdt: Add support ...
738
  	@rm -f $(obj)u-boot.dtb
30b9b932a   Marek Vasut   iMX28: Add u-boot...
739
  	@rm -f $(obj)u-boot.sb
dca61f012   Andreas Bießmann   tools/env: use li...
740
  	@rm -f $(obj)tools/inca-swap-bytes
a47a12bec   Stefan Roese   Move arch/ppc to ...
741
  	@rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c
2d14e36a5   York Sun   powerpc/mpc83xx: ...
742
  	@rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c
a9d8bc980   Loïc Minier   Don't add symlink...
743
  	@rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
16a354f92   Wolfgang Denk   include/asm-offse...
744
  	@rm -fr $(obj)include/generated
a958b663d   Jean-Christophe PLAGNIOL-VILLARD   Makefile: fix pos...
745
746
  	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
  	@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
bbb0b128c   Simon Glass   fdt: Add support ...
747
  	@rm -f $(obj)dts/*.tmp
f93286397   Marian Balakowicz   Add support for a...
748

f93286397   Marian Balakowicz   Add support for a...
749
750
  mrproper \
  distclean:	clobber unconfig
afd077bd1   Mike Frysinger   simplify clobber ...
751
  ifneq ($(OBJTREE),$(SRCTREE))
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
752
  	rm -rf $(obj)*
f93286397   Marian Balakowicz   Add support for a...
753
  endif
7ebf7443a   wdenk   Initial revision
754
755
756
  
  backup:
  	F=`basename $(TOPDIR)` ; cd .. ; \
d6b937142   Ilya Yanok   Makefile: always ...
757
  	gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
7ebf7443a   wdenk   Initial revision
758
759
  
  #########################################################################