Blame view

Makefile 25.3 KB
7ebf7443a   wdenk   Initial revision
1
  #
b1af6f532   Wolfgang Denk   Prepare v2011.06
2
  # (C) Copyright 2000-2011
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
  #
42d44f631   Wolfgang Denk   Prepare v2011.03-rc1
23
  VERSION = 2011
5738946be   Wolfgang Denk   Prepare v2011.12-rc1
24
  PATCHLEVEL = 12
8b9e47876   Wolfgang Denk   Update CHANGELOG,...
25
  SUBLEVEL =
cba9a894f   Wolfgang Denk   Prepare v2011.12
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  # 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.
  
  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
  
  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)),)
  $(error could not find linker script)
  	endif
  endif
7ebf7443a   wdenk   Initial revision
194
195
  #########################################################################
  # U-Boot objects....order is important (i.e. start must be first)
03b7004dd   Peter Tyser   Create CPUDIR var...
196
  OBJS  = $(CPUDIR)/start.o
fea257200   Graeme Russ   x86: Rename i386 ...
197
  ifeq ($(CPU),x86)
03b7004dd   Peter Tyser   Create CPUDIR var...
198
199
  OBJS += $(CPUDIR)/start16.o
  OBJS += $(CPUDIR)/resetvec.o
2262cfeef   wdenk   * Patch by Daniel...
200
  endif
7ebf7443a   wdenk   Initial revision
201
  ifeq ($(CPU),ppc4xx)
03b7004dd   Peter Tyser   Create CPUDIR var...
202
  OBJS += $(CPUDIR)/resetvec.o
7ebf7443a   wdenk   Initial revision
203
  endif
42d1f0394   wdenk   * Patches by Xian...
204
  ifeq ($(CPU),mpc85xx)
03b7004dd   Peter Tyser   Create CPUDIR var...
205
  OBJS += $(CPUDIR)/resetvec.o
42d1f0394   wdenk   * Patches by Xian...
206
  endif
7ebf7443a   wdenk   Initial revision
207

f93286397   Marian Balakowicz   Add support for a...
208
  OBJS := $(addprefix $(obj),$(OBJS))
6d8962e81   Sebastien Carlier   Switch from archi...
209
210
211
  LIBS  = lib/libgeneric.o
  LIBS += lib/lzma/liblzma.o
  LIBS += lib/lzo/liblzo.o
e89516f03   Mike Frysinger   zlib: split up to...
212
  LIBS += lib/zlib/libz.o
7608d75f9   Kim Phillips   support board ven...
213
  LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
6d8962e81   Sebastien Carlier   Switch from archi...
214
215
  	"board/$(VENDOR)/common/lib$(VENDOR).o"; fi)
  LIBS += $(CPUDIR)/lib$(CPU).o
1d9f41050   wdenk   Patch by Steven S...
216
  ifdef SOC
6d8962e81   Sebastien Carlier   Switch from archi...
217
  LIBS += $(CPUDIR)/$(SOC)/lib$(SOC).o
1d9f41050   wdenk   Patch by Steven S...
218
  endif
323bfa8f4   Stefan Roese   Remove BOARDLIBS ...
219
  ifeq ($(CPU),ixp)
6d8962e81   Sebastien Carlier   Switch from archi...
220
  LIBS += arch/arm/cpu/ixp/npe/libnpe.o
323bfa8f4   Stefan Roese   Remove BOARDLIBS ...
221
  endif
bbb0b128c   Simon Glass   fdt: Add support ...
222
223
224
  ifeq ($(CONFIG_OF_EMBED),y)
  LIBS += dts/libdts.o
  endif
6d8962e81   Sebastien Carlier   Switch from archi...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  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...
252
  ifeq ($(CPU),mpc83xx)
6d8962e81   Sebastien Carlier   Switch from archi...
253
  LIBS += drivers/qe/libqe.o
d29d17d7b   York Sun   powerpc/mpc83xx: ...
254
  LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
6d8962e81   Sebastien Carlier   Switch from archi...
255
  LIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
7737d5c65   Dave Liu   mpc83xx: add QE e...
256
  endif
da9d4610d   Andy Fleming   Add support for U...
257
  ifeq ($(CPU),mpc85xx)
6d8962e81   Sebastien Carlier   Switch from archi...
258
  LIBS += drivers/qe/libqe.o
c916d7c91   Kumar Gala   powerpc/85xx: Add...
259
  LIBS += drivers/net/fm/libfm.o
6d8962e81   Sebastien Carlier   Switch from archi...
260
261
  LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
  LIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
58e5e9aff   Kumar Gala   FSL DDR: Rewrite ...
262
263
  endif
  ifeq ($(CPU),mpc86xx)
6d8962e81   Sebastien Carlier   Switch from archi...
264
265
  LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
  LIBS += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
da9d4610d   Andy Fleming   Add support for U...
266
  endif
6d8962e81   Sebastien Carlier   Switch from archi...
267
268
  LIBS += drivers/rtc/librtc.o
  LIBS += drivers/serial/libserial.o
5e1247247   Vadim Bendebury   Introduce generic...
269
270
271
  ifeq ($(CONFIG_GENERIC_LPC_TPM),y)
  LIBS += drivers/tpm/libtpm.o
  endif
6d8962e81   Sebastien Carlier   Switch from archi...
272
  LIBS += drivers/twserial/libtws.o
181f565c2   Mike Frysinger   usb: convert to p...
273
  LIBS += drivers/usb/eth/libusb_eth.o
6d8962e81   Sebastien Carlier   Switch from archi...
274
275
276
277
  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 ...
278
  LIBS += drivers/usb/ulpi/libusb_ulpi.o
6d8962e81   Sebastien Carlier   Switch from archi...
279
280
281
282
283
284
  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...
285

a9c1c0424   Sricharan   omap5: Add omap5_...
286
  ifneq ($(CONFIG_AM335X)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
f0f4b5ff5   Chandan Nath   ARM:AM33XX: Added...
287
288
  LIBS += $(CPUDIR)/omap-common/libomap-common.o
  endif
18936ee2a   Jason Liu   i.mx: introduce t...
289
290
291
292
293
294
295
  
  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 ...
296
  ifeq ($(SOC),s5pc1xx)
6d8962e81   Sebastien Carlier   Switch from archi...
297
  LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
852bd07c8   Minkyu Kang   ARMV7: S5P: make ...
298
  endif
393cb3619   Chander Kashyap   S5PC2XX: Rename S...
299
  ifeq ($(SOC),exynos)
6d8962e81   Sebastien Carlier   Switch from archi...
300
  LIBS += $(CPUDIR)/s5p-common/libs5p-common.o
852bd07c8   Minkyu Kang   ARMV7: S5P: make ...
301
  endif
566d49a3f   Wolfgang Denk   512x: Cleanup for...
302
  LIBS := $(addprefix $(obj),$(sort $(LIBS)))
249b53a61   Loïc Minier   Build timestamp_a...
303
  .PHONY : $(LIBS)
a8c7c708a   wdenk   * Patch by Gleb N...
304

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

6ac9f4797   Mike Frysinger   start a linker sc...
320
321
322
323
324
325
326
  # 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 \
  	$(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...
327
  __OBJS := $(subst $(obj),,$(OBJS))
de109d909   Wolfgang Denk   Makefile: fix par...
328
  __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
f93286397   Marian Balakowicz   Add support for a...
329

7ebf7443a   wdenk   Initial revision
330
  #########################################################################
bdccc4fed   wdenk   * Map ISP1362 USB...
331
  #########################################################################
7ebf7443a   wdenk   Initial revision
332

f3a14d377   Mike Frysinger   Makefile: allow b...
333
334
335
336
337
338
339
340
341
342
343
344
345
346
  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...
347
  # Always append ALL so that arch config.mk's can add custom ones
4e0fbb98f   Daniel Schwierzeck   Use ALL-y style i...
348
  ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
e935a374d   Haiying Wang   Fix NAND_SPL and ...
349

4e0fbb98f   Daniel Schwierzeck   Use ALL-y style i...
350
351
  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 ...
352
  ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
4e0fbb98f   Daniel Schwierzeck   Use ALL-y style i...
353
  ALL-$(CONFIG_MMC_U_BOOT) += $(obj)mmc_spl/u-boot-mmc-spl.bin
5df2ee27d   Daniel Schwierzeck   Hook SPL build-sy...
354
  ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
2c0f79e44   Simon Glass   fdt: Add support ...
355
  ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
0d3c62e46   Chander Kashyap   ARMV7: MMC SPL Bo...
356

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

2c0f79e44   Simon Glass   fdt: Add support ...
359
360
361
362
363
364
  $(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...
365
  $(obj)u-boot.hex:	$(obj)u-boot
6310eb9da   wdenk   Patches by David ...
366
  		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
f93286397   Marian Balakowicz   Add support for a...
367
  $(obj)u-boot.srec:	$(obj)u-boot
0817d688f   Ricardo Ribalda Delgado   Remove gap fill i...
368
  		$(OBJCOPY) -O srec $< $@
7ebf7443a   wdenk   Initial revision
369

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

94a91e248   Mike Frysinger   generate u-boot.l...
374
  $(obj)u-boot.ldr:	$(obj)u-boot
76d82187c   Mike Frysinger   Blackfin: tweak e...
375
  		$(CREATE_LDR_ENV)
68e563249   Mike Frysinger   Blackfin: dont ge...
376
  		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
f3a14d377   Mike Frysinger   Makefile: allow b...
377
  		$(BOARD_SIZE_CHECK)
94a91e248   Mike Frysinger   generate u-boot.l...
378
379
380
381
382
383
  
  $(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...
384
  $(obj)u-boot.img:	$(obj)u-boot.bin
a2a0a7171   Wolfgang Denk   Makefile: fix out...
385
  		$(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
3857f8f5a   aneeshv   Correct ih_os for...
386
  		-O u-boot -a $(CONFIG_SYS_TEXT_BASE) -e 0 \
881a87ecb   Wolfgang Denk   Add GIT version i...
387
  		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
bdccc4fed   wdenk   * Map ISP1362 USB...
388
389
  			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
  		-d $< $@
8edcde5e4   Stefano Babic   mkimage: Add Free...
390
  $(obj)u-boot.imx:       $(obj)u-boot.bin
45d7d72b0   Stefano Babic   Makefile: change ...
391
  		$(obj)tools/mkimage -n  $(CONFIG_IMX_CONFIG) -T imximage \
14d0a02a1   Wolfgang Denk   Rename TEXT_BASE ...
392
  		-e $(CONFIG_SYS_TEXT_BASE) -d $< $@
8edcde5e4   Stefano Babic   mkimage: Add Free...
393

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

566a494f5   Heiko Schocher   [PCS440EP] u...
398
  $(obj)u-boot.sha1:	$(obj)u-boot.bin
011595307   Heiko Schocher   [PCS440EP] - fix...
399
  		$(obj)tools/ubsha1 $(obj)u-boot.bin
566a494f5   Heiko Schocher   [PCS440EP] u...
400

f93286397   Marian Balakowicz   Add support for a...
401
  $(obj)u-boot.dis:	$(obj)u-boot
7ebf7443a   wdenk   Initial revision
402
  		$(OBJDUMP) -d $< > $@
435199f38   Heiko Schocher   arm, davinci: add...
403
404
405
  $(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 ...
406
  		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
435199f38   Heiko Schocher   arm, davinci: add...
407
408
409
  		-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 ...
410

d36d88598   Christian Riesch   arm, davinci: Add...
411
412
413
414
415
416
417
418
419
420
421
  $(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...
422
423
424
  $(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...
425
426
427
428
429
430
  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...
431
  GEN_UBOOT = \
de109d909   Wolfgang Denk   Makefile: fix par...
432
433
  		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 ...
434
  		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__OBJS) \
f93286397   Marian Balakowicz   Add support for a...
435
  			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
b2184c314   wdenk   * Patch by Daniel...
436
  			-Map u-boot.map -o u-boot
86eb49b3e   Simon Glass   sandbox: Makefile...
437
  endif
16a354f92   Wolfgang Denk   include/asm-offse...
438
  $(obj)u-boot:	depend \
349e83f07   Che-liang Chiou   examples: api: al...
439
  		$(SUBDIR_TOOLS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
ecb1dc892   Mike Frysinger   Add support for L...
440
441
  		$(GEN_UBOOT)
  ifeq ($(CONFIG_KALLSYMS),y)
1aada9cd6   Wolfgang Denk   Fix all linker sc...
442
443
444
445
  		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...
446
447
  		$(GEN_UBOOT) $(obj)common/system_map.o
  endif
7ebf7443a   wdenk   Initial revision
448

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

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

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

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

e935a374d   Haiying Wang   Fix NAND_SPL and ...
468
  $(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
8318fbf8c   Marian Balakowicz   Fix sequoia separ...
469
  		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...
470

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

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

0d3c62e46   Chander Kashyap   ARMV7: MMC SPL Bo...
477
478
479
480
  mmc_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
  		$(MAKE) -C mmc_spl/board/$(BOARDDIR) all
  
  $(obj)mmc_spl/u-boot-mmc-spl.bin:	mmc_spl
bd25fdba4   Aneesh V   Makefile: Add the...
481
  $(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
5df2ee27d   Daniel Schwierzeck   Hook SPL build-sy...
482
  		$(MAKE) -C spl all
f93286397   Marian Balakowicz   Add support for a...
483
  updater:
0358df427   Mike Frysinger   unify toplevel to...
484
  		$(MAKE) -C tools/updater all
8f713fdfe   dzu   Removed tools/gdb...
485

2a9987935   Daniel Hobi   Makefile: fix par...
486
487
  # Explicitly make _depend in subdirs containing multiple targets to prevent
  # parallel sub-makes creating .depend files simultaneously.
16a354f92   Wolfgang Denk   include/asm-offse...
488
489
  depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) \
  		$(obj)include/autoconf.mk \
a4814a69d   Stefano Babic   Makefile : fix ge...
490
491
  		$(obj)include/generated/generic-asm-offsets.h \
  		$(obj)include/generated/asm-offsets.h
03b7004dd   Peter Tyser   Create CPUDIR var...
492
  		for dir in $(SUBDIRS) $(CPUDIR) $(dir $(LDSCRIPT)) ; do \
2a9987935   Daniel Hobi   Makefile: fix par...
493
  			$(MAKE) -C $$dir _depend ; done
7ebf7443a   wdenk   Initial revision
494

e5e4e705c   Li Yang   Update Makefile f...
495
496
  TAG_SUBDIRS = $(SUBDIRS)
  TAG_SUBDIRS += $(dir $(__LIBS))
a340c325e   Jean-Christophe PLAGNIOL-VILLARD   Makefile : fix ta...
497
  TAG_SUBDIRS += include
a340c325e   Jean-Christophe PLAGNIOL-VILLARD   Makefile : fix ta...
498

857d9ea67   Horst Kronstorfer   Let source cross-...
499
500
  FIND := find
  FINDFLAGS := -L
f93286397   Marian Balakowicz   Add support for a...
501
  tags ctags:
857d9ea67   Horst Kronstorfer   Let source cross-...
502
  		ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
e5e4e705c   Li Yang   Update Makefile f...
503
  						-name '*.[chS]' -print`
7ebf7443a   wdenk   Initial revision
504
505
  
  etags:
857d9ea67   Horst Kronstorfer   Let source cross-...
506
  		etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
e5e4e705c   Li Yang   Update Makefile f...
507
  						-name '*.[chS]' -print`
ffda586fc   Li Yang   add cscope build ...
508
  cscope:
857d9ea67   Horst Kronstorfer   Let source cross-...
509
510
  		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
  						cscope.files
ffda586fc   Li Yang   add cscope build ...
511
  		cscope -b -q -k
7ebf7443a   wdenk   Initial revision
512

ecb1dc892   Mike Frysinger   Add support for L...
513
514
  SYSTEM_MAP = \
  		$(NM) $1 | \
7ebf7443a   wdenk   Initial revision
515
  		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
ecb1dc892   Mike Frysinger   Add support for L...
516
517
518
  		LC_ALL=C sort
  $(obj)System.map:	$(obj)u-boot
  		@$(call SYSTEM_MAP,$<) > $(obj)System.map
7ebf7443a   wdenk   Initial revision
519

2f155f6c0   Grant Likely   [BUILD] Generate ...
520
521
522
523
524
525
  #
  # 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...
526
527
  $(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
  	@$(XECHO) Generating $@ ; \
16fe77752   Mike Frysinger   error check autoc...
528
  	set -e ; \
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
529
  	: Generate the dependancies ; \
4c34b2a09   Mike Frysinger   autoconf.mk.dep: ...
530
  	$(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
1510b82d5   Wolfgang Denk   Makefile: fix "er...
531
532
533
534
535
  		-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...
536
  	: Extract the config macros ; \
1510b82d5   Wolfgang Denk   Makefile: fix "er...
537
  	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
4a0f7538c   Wolfgang Denk   Makefile: fix dep...
538
539
  		sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
  	mv $@.tmp $@
2f155f6c0   Grant Likely   [BUILD] Generate ...
540

16a354f92   Wolfgang Denk   include/asm-offse...
541
542
543
544
545
546
547
548
549
550
551
  $(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...
552
553
554
555
556
557
558
559
560
561
562
563
564
565
  $(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
566
  #########################################################################
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
567
  else	# !config.mk
f93286397   Marian Balakowicz   Add support for a...
568
569
  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...
570
  $(filter-out tools,$(SUBDIRS)) \
0358df427   Mike Frysinger   unify toplevel to...
571
  updater depend dep tags ctags etags cscope $(obj)System.map:
7ebf7443a   wdenk   Initial revision
572
573
  	@echo "System not configured - see README" >&2
  	@ exit 1
c7c0d542a   Mike Frysinger   tools: allow peop...
574

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

28abd48f5   Ilya Yanok   Makefile: move $(...
579
  $(VERSION_FILE):
14ce91b11   Mike Frysinger   fix unconfigured ...
580
  		@mkdir -p $(dir $(VERSION_FILE))
28abd48f5   Ilya Yanok   Makefile: move $(...
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
  		@( 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...
596
597
  $(TIMESTAMP_FILE):
  		@mkdir -p $(dir $(TIMESTAMP_FILE))
a76406fb0   Loïc Minier   Safer timestamp_a...
598
599
600
  		@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...
601

0358df427   Mike Frysinger   unify toplevel to...
602
603
604
  easylogo env gdb:
  	$(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION}
  gdbtools: gdb
249b53a61   Loïc Minier   Build timestamp_a...
605
  tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
0358df427   Mike Frysinger   unify toplevel to...
606
  	$(MAKE) -C tools HOST_TOOLS_ALL=y
4e53a2585   Wolfgang Denk   Fix Makefile for ...
607
608
  .PHONY : CHANGELOG
  CHANGELOG:
b985b5d6e   Ben Warren   Fix TSEC driver: ...
609
610
  	git log --no-merges U-Boot-1_1_5.. | \
  	unexpand -a | sed -e 's/\s\s*$$//' > $@
4e53a2585   Wolfgang Denk   Fix Makefile for ...
611

0a823aa2a   Harald Welte   Add 'license' com...
612
  include/license.h: tools/bin2header COPYING
0e42ada31   Wolfgang Denk   Fix printing of m...
613
  	cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
7ebf7443a   wdenk   Initial revision
614
615
616
  #########################################################################
  
  unconfig:
887e2ec9e   Stefan Roese   Add support for A...
617
  	@rm -f $(obj)include/config.h $(obj)include/config.mk \
2f155f6c0   Grant Likely   [BUILD] Generate ...
618
619
  		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
  		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
7ebf7443a   wdenk   Initial revision
620

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

8c994630b   Wolfgang Denk   Makefile: simplif...
627
628
629
630
631
  #
  # 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
632
633
634
  #========================================================================
  # ARM
  #========================================================================
43a5f0df2   Po-Yu Chuang   arm: A320: Add su...
635

080cfee71   Vipin KUMAR   SPEAr : Support a...
636
  spear300_config \
7da692360   Vipin KUMAR   SPEAr : Support a...
637
638
  spear310_config \
  spear320_config :	unconfig
ed7a196cd   Wolfgang Denk   Makefile: simplif...
639
  	@$(MKCONFIG) -n $@ -t $@ spear3xx arm arm926ejs $(@:_config=) spear spear
7e074158c   Vipin KUMAR   SPEAr : Support a...
640

566c9c16f   Vipin KUMAR   SPEAr : Support a...
641
  spear600_config :	unconfig
ed7a196cd   Wolfgang Denk   Makefile: simplif...
642
  	@$(MKCONFIG) -n $@ -t $@ spear6xx arm arm926ejs $(@:_config=) spear spear
566c9c16f   Vipin KUMAR   SPEAr : Support a...
643

47fd3bffe   Jean-Christophe PLAGNIOL-VILLARD   SX1: add CONFIG_S...
644
645
646
647
648
  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...
649
650
  	else \
  		echo "#define CONFIG_STDOUT_USBTTY" >> $(obj)include/config.h ; \
47fd3bffe   Jean-Christophe PLAGNIOL-VILLARD   SX1: add CONFIG_S...
651
  	fi;
0e42ada31   Wolfgang Denk   Fix printing of m...
652
  	@$(MKCONFIG) -n $@ SX1 arm arm925t sx1
2d24a3a78   wdenk   * Patch by Yuli B...
653

699f05125   Wolfgang Denk   Prepare v1.3.4-rc...
654
  #########################################################################
43d9616cf   wdenk   * Patch by Robert...
655
  ## XScale Systems
7ebf7443a   wdenk   Initial revision
656
  #########################################################################
9d8d5a5bf   Stefan Roese   [PATCH] Add suppo...
657
  pdnb3_config \
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
658
  scpu_config:	unconfig
cdd917a43   Wolfgang Denk   Fix build errors ...
659
  	@mkdir -p $(obj)include
9d8d5a5bf   Stefan Roese   [PATCH] Add suppo...
660
  	@if [ "$(findstring scpu_,$@)" ] ; then \
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
661
  		echo "#define CONFIG_SCPU"	>>$(obj)include/config.h ; \
9d8d5a5bf   Stefan Roese   [PATCH] Add suppo...
662
  	fi
0e42ada31   Wolfgang Denk   Fix printing of m...
663
  	@$(MKCONFIG) -n $@ -a pdnb3 arm ixp pdnb3 prodrive
ba94a1bba   Wolfgang Denk   * Update Intel IX...
664

8c994630b   Wolfgang Denk   Makefile: simplif...
665
  #########################################################################
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
666
667
668
669
670
671
672
  ## 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...
673
  	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
674
675
  	@if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then			\
  		echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
676
677
  	else										\
  		echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
678
  	fi
54e19a7de   Wolfgang Denk   Merge branch 'mas...
679
  	@$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx
11edcfe26   Guennadi Liakhovetski   ARM: Add support ...
680
  	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
0afe519a4   Wolfgang Denk   Add ADI Blackfin ...
681
  #########################################################################
3e38691e8   wdenk   * Patch by Arun D...
682
  #########################################################################
7ebf7443a   wdenk   Initial revision
683
684
  
  clean:
1bc153861   Peter Tyser   Move examples/ to...
685
  	@rm -f $(obj)examples/standalone/82559_eeprom			  \
d640ac58d   Wolfgang Denk   Remove "atmel_df_...
686
  	       $(obj)examples/standalone/atmel_df_pow2			  \
1bc153861   Peter Tyser   Move examples/ to...
687
688
689
690
691
  	       $(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...
692
  	       $(obj)examples/standalone/smc911{11,x}_eeprom		  \
1bc153861   Peter Tyser   Move examples/ to...
693
694
  	       $(obj)examples/standalone/test_burst			  \
  	       $(obj)examples/standalone/timer
d4abc757c   Peter Tyser   Move api_examples...
695
  	@rm -f $(obj)examples/api/demo{,.bin}
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
696
697
698
699
700
  	@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...
701
  	       $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk	  \
f9301e1cd   Wolfgang Denk   Makefile: fix pro...
702
703
  	       $(obj)tools/ncb		   $(obj)tools/ubsha1
  	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
74c7a95f2   Wolfgang Denk   Makefile: clean M...
704
  	       $(obj)board/matrix_vision/*/bootscript.img		  \
566e5cf45   Wolfgang Denk   ARM: drop unsuppo...
705
  	       $(obj)board/voiceblue/eeprom 				  \
1aada9cd6   Wolfgang Denk   Fix all linker sc...
706
  	       $(obj)u-boot.lds						  \
fb5166ce3   Mike Frysinger   Blackfin: add ini...
707
708
  	       $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]	  \
  	       $(obj)arch/blackfin/cpu/init.{lds,elf}
dc7746d86   Wolfgang Denk   Makefile: remove ...
709
  	@rm -f $(obj)include/bmp_logo.h
c270730f5   Che-Liang Chiou   tools: logo: spli...
710
  	@rm -f $(obj)include/bmp_logo_data.h
16a354f92   Wolfgang Denk   include/asm-offse...
711
  	@rm -f $(obj)lib/asm-offsets.s
a4814a69d   Stefano Babic   Makefile : fix ge...
712
713
  	@rm -f $(obj)include/generated/asm-offsets.h
  	@rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
ff6b47ad2   Kumar Gala   Makefile: need to...
714
  	@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 ...
715
  	@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
0d3c62e46   Chander Kashyap   ARMV7: MMC SPL Bo...
716
  	@rm -f $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin}
ca6189db4   Kyungmin Park   Refactor OneNAND ...
717
  	@rm -f $(ONENAND_BIN)
1aada9cd6   Wolfgang Denk   Fix all linker sc...
718
  	@rm -f $(obj)onenand_ipl/u-boot.lds
5df2ee27d   Daniel Schwierzeck   Hook SPL build-sy...
719
  	@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 ...
720
  	@rm -f $(obj)MLO
d4abc757c   Peter Tyser   Move api_examples...
721
  	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
ae6d1056d   Wolfgang Denk   Fix Makefile depe...
722
  	@find $(OBJTREE) -type f \
7ebf7443a   wdenk   Initial revision
723
  		\( -name 'core' -o -name '*.bak' -o -name '*~' \
2b48f7d5f   Peter Tyser   Makefile: Add rem...
724
  		-o -name '*.o'	-o -name '*.a' -o -name '*.exe'	\) -print \
7ebf7443a   wdenk   Initial revision
725
  		| xargs rm -f
7ebf7443a   wdenk   Initial revision
726

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

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