Makefile 122 KB
Newer Older
wdenk's avatar
wdenk committed
1
#
2
# (C) Copyright 2000-2009
wdenk's avatar
wdenk committed
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
10
# published by the Free Software Foundatio; either version 2 of
wdenk's avatar
wdenk committed
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
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
wdenk's avatar
wdenk committed
16
17
18
19
20
21
22
23
# 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
#

Wolfgang Denk's avatar
Wolfgang Denk committed
24
VERSION = 2009
25
PATCHLEVEL = 11
Wolfgang Denk's avatar
Wolfgang Denk committed
26
SUBLEVEL = 1
27
EXTRAVERSION =
28
ifneq "$(SUBLEVEL)" ""
29
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
30
31
32
else
U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
endif
33
TIMESTAMP_FILE = $(obj)include/timestamp_autogenerated.h
34
VERSION_FILE = $(obj)include/version_autogenerated.h
35

wdenk's avatar
wdenk committed
36
37
38
39
40
41
HOSTARCH := $(shell uname -m | \
	sed -e s/i.86/i386/ \
	    -e s/sun4u/sparc64/ \
	    -e s/arm.*/arm/ \
	    -e s/sa110/arm/ \
	    -e s/powerpc/ppc/ \
Kumar Gala's avatar
Kumar Gala committed
42
	    -e s/ppc64/ppc/ \
wdenk's avatar
wdenk committed
43
44
	    -e s/macppc/ppc/)

45
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
wdenk's avatar
wdenk committed
46
47
	    sed -e 's/\(cygwin\).*/cygwin/')

48
49
50
51
52
53
# 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
wdenk's avatar
wdenk committed
54
55
56
57

# Deal with colliding definitions from tcsh etc.
VENDOR=

58
59
60
61
62
63
64
65
#########################################################################
# Allow for silent builds
ifeq (,$(findstring s,$(MAKEFLAGS)))
XECHO = echo
else
XECHO = :
endif

wdenk's avatar
wdenk committed
66
#########################################################################
67
68
69
#
# U-boot build supports producing a object files to the separate external
# directory. Two use cases are supported:
70
#
71
72
73
74
75
76
77
78
79
80
# 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'
81
#
82
# Command line 'O=' setting overrides BUILD_DIR environent variable.
83
#
84
85
# When none of the above methods is used the local build is performed and
# the object files are placed in the source directory.
86
#
87
88
89
90
91
92
93
94
95

ifdef O
ifeq ("$(origin O)", "command line")
BUILD_DIR := $(O)
endif
endif

ifneq ($(BUILD_DIR),)
saved-output := $(BUILD_DIR)
96
97
98
99

# Attempt to create a output directory.
$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})

Stefan Roese's avatar
Stefan Roese committed
100
# Verify if it was successful.
101
102
103
104
105
106
107
108
109
110
111
112
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))
SRCTREE		:= $(CURDIR)
TOPDIR		:= $(SRCTREE)
LNDIR		:= $(OBJTREE)
export	TOPDIR SRCTREE OBJTREE

MKCONFIG	:= $(SRCTREE)/mkconfig
export MKCONFIG
wdenk's avatar
wdenk committed
113

114
ifneq ($(OBJTREE),$(SRCTREE))
Wolfgang Denk's avatar
Wolfgang Denk committed
115
REMOTE_BUILD	:= 1
116
117
118
119
120
121
122
123
124
125
126
127
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 :=
128
endif
129
130
export obj src

131
132
133
# Make sure CDPATH settings don't interfere
unexport CDPATH

wdenk's avatar
wdenk committed
134
135
#########################################################################

136
137
138
139
ifeq ($(ARCH),powerpc)
ARCH = ppc
endif

140
141
142
# The "tools" are needed early, so put this first
# Don't include stuff already done in $(LIBS)
SUBDIRS	= tools \
143
	  examples/standalone \
144
	  examples/api
145
146
147

.PHONY : $(SUBDIRS)

148
ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
wdenk's avatar
wdenk committed
149

150
151
152
153
154
155
156
# 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

wdenk's avatar
wdenk committed
157
# load ARCH, BOARD, and CPU configuration
158
include $(obj)include/config.mk
wdenk's avatar
wdenk committed
159
export	ARCH CPU BOARD VENDOR SOC
160

161
# set default to nothing for native builds
Wolfgang Denk's avatar
Wolfgang Denk committed
162
ifeq ($(HOSTARCH),$(ARCH))
163
CROSS_COMPILE ?=
wdenk's avatar
wdenk committed
164
endif
wdenk's avatar
wdenk committed
165

166
167
168
# load other configuration
include $(TOPDIR)/config.mk

wdenk's avatar
wdenk committed
169
170
171
#########################################################################
# U-Boot objects....order is important (i.e. start must be first)

wdenk's avatar
wdenk committed
172
OBJS  = cpu/$(CPU)/start.o
173
ifeq ($(CPU),i386)
wdenk's avatar
wdenk committed
174
OBJS += cpu/$(CPU)/start16.o
175
OBJS += cpu/$(CPU)/resetvec.o
176
endif
wdenk's avatar
wdenk committed
177
ifeq ($(CPU),ppc4xx)
wdenk's avatar
wdenk committed
178
OBJS += cpu/$(CPU)/resetvec.o
wdenk's avatar
wdenk committed
179
endif
180
181
182
ifeq ($(CPU),mpc85xx)
OBJS += cpu/$(CPU)/resetvec.o
endif
wdenk's avatar
wdenk committed
183

184
185
OBJS := $(addprefix $(obj),$(OBJS))

wdenk's avatar
wdenk committed
186
LIBS  = lib_generic/libgeneric.a
187
LIBS += lib_generic/lzma/liblzma.a
Stefan Roese's avatar
Stefan Roese committed
188
LIBS += lib_generic/lzo/liblzo.a
189
190
LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
	"board/$(VENDOR)/common/lib$(VENDOR).a"; fi)
wdenk's avatar
wdenk committed
191
LIBS += cpu/$(CPU)/lib$(CPU).a
wdenk's avatar
wdenk committed
192
193
194
ifdef SOC
LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
endif
195
196
197
ifeq ($(CPU),ixp)
LIBS += cpu/ixp/npe/libnpe.a
endif
wdenk's avatar
wdenk committed
198
LIBS += lib_$(ARCH)/lib$(ARCH).a
wdenk's avatar
wdenk committed
199
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
200
201
	fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a fs/yaffs2/libyaffs2.a \
	fs/ubifs/libubifs.a
wdenk's avatar
wdenk committed
202
203
LIBS += net/libnet.a
LIBS += disk/libdisk.a
204
LIBS += drivers/bios_emulator/libatibiosemu.a
205
LIBS += drivers/block/libblock.a
206
LIBS += drivers/dma/libdma.a
207
LIBS += drivers/fpga/libfpga.a
208
LIBS += drivers/gpio/libgpio.a
209
LIBS += drivers/hwmon/libhwmon.a
210
LIBS += drivers/i2c/libi2c.a
211
LIBS += drivers/input/libinput.a
212
LIBS += drivers/misc/libmisc.a
213
LIBS += drivers/mmc/libmmc.a
214
215
216
LIBS += drivers/mtd/libmtd.a
LIBS += drivers/mtd/nand/libnand.a
LIBS += drivers/mtd/onenand/libonenand.a
217
LIBS += drivers/mtd/ubi/libubi.a
Haavard Skinnemoen's avatar
Haavard Skinnemoen committed
218
LIBS += drivers/mtd/spi/libspi_flash.a
219
LIBS += drivers/net/libnet.a
220
LIBS += drivers/net/phy/libphy.a
221
222
223
LIBS += drivers/net/sk98lin/libsk98lin.a
LIBS += drivers/pci/libpci.a
LIBS += drivers/pcmcia/libpcmcia.a
Tom Rix's avatar
Tom Rix committed
224
LIBS += drivers/power/libpower.a
225
LIBS += drivers/spi/libspi.a
Dave Liu's avatar
Dave Liu committed
226
227
228
ifeq ($(CPU),mpc83xx)
LIBS += drivers/qe/qe.a
endif
Andy Fleming's avatar
Andy Fleming committed
229
230
ifeq ($(CPU),mpc85xx)
LIBS += drivers/qe/qe.a
231
LIBS += cpu/mpc8xxx/ddr/libddr.a
232
LIBS += cpu/mpc8xxx/lib8xxx.a
Ed Swarthout's avatar
Ed Swarthout committed
233
TAG_SUBDIRS += cpu/mpc8xxx
234
235
236
endif
ifeq ($(CPU),mpc86xx)
LIBS += cpu/mpc8xxx/ddr/libddr.a
237
LIBS += cpu/mpc8xxx/lib8xxx.a
Ed Swarthout's avatar
Ed Swarthout committed
238
TAG_SUBDIRS += cpu/mpc8xxx
Andy Fleming's avatar
Andy Fleming committed
239
endif
240
LIBS += drivers/rtc/librtc.a
241
LIBS += drivers/serial/libserial.a
242
LIBS += drivers/twserial/libtws.a
243
244
245
LIBS += drivers/usb/gadget/libusb_gadget.a
LIBS += drivers/usb/host/libusb_host.a
LIBS += drivers/usb/musb/libusb_musb.a
246
LIBS += drivers/video/libvideo.a
247
LIBS += drivers/watchdog/libwatchdog.a
wdenk's avatar
wdenk committed
248
LIBS += common/libcommon.a
249
LIBS += libfdt/libfdt.a
250
LIBS += api/libapi.a
251
LIBS += post/libpost.a
252
253

LIBS := $(addprefix $(obj),$(LIBS))
254
.PHONY : $(LIBS) $(TIMESTAMP_FILE) $(VERSION_FILE)
wdenk's avatar
wdenk committed
255

Wolfgang Denk's avatar
Wolfgang Denk committed
256
257
258
LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
LIBBOARD := $(addprefix $(obj),$(LIBBOARD))

wdenk's avatar
wdenk committed
259
# Add GCC lib
260
261
262
263
264
265
266
267
268
269
270
ifdef USE_PRIVATE_LIBGCC
ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
PLATFORM_LIBGCC = -L $(OBJTREE)/lib_$(ARCH) -lgcc
else
PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
endif
else
PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
endif
PLATFORM_LIBS += $(PLATFORM_LIBGCC)
export PLATFORM_LIBS
271

272
273
274
275
276
277
278
279
# 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')

280
281
282
283
284
ifeq ($(CONFIG_NAND_U_BOOT),y)
NAND_SPL = nand_spl
U_BOOT_NAND = $(obj)u-boot-nand.bin
endif

285
286
287
ifeq ($(CONFIG_ONENAND_U_BOOT),y)
ONENAND_IPL = onenand_ipl
U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
Kyungmin Park's avatar
Kyungmin Park committed
288
ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin
289
290
endif

291
__OBJS := $(subst $(obj),,$(OBJS))
Wolfgang Denk's avatar
Wolfgang Denk committed
292
__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
293

294
#########################################################################
wdenk's avatar
wdenk committed
295
296
#########################################################################

297
# Always append ALL so that arch config.mk's can add custom ones
298
ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)
wdenk's avatar
wdenk committed
299

300
all:		$(ALL)
wdenk's avatar
wdenk committed
301

302
$(obj)u-boot.hex:	$(obj)u-boot
wdenk's avatar
wdenk committed
303
304
		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@

305
$(obj)u-boot.srec:	$(obj)u-boot
306
		$(OBJCOPY) -O srec $< $@
wdenk's avatar
wdenk committed
307

308
$(obj)u-boot.bin:	$(obj)u-boot
wdenk's avatar
wdenk committed
309
310
		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@

311
$(obj)u-boot.ldr:	$(obj)u-boot
312
		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
313
		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
314
315
316
317
318
319
320

$(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

321
$(obj)u-boot.img:	$(obj)u-boot.bin
322
323
		./tools/mkimage -A $(ARCH) -T firmware -C none \
		-a $(TEXT_BASE) -e 0 \
324
		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
325
326
327
			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
		-d $< $@

328
329
330
331
$(obj)u-boot.kwb:       $(obj)u-boot.bin
		$(obj)tools/mkimage -n $(KWD_CONFIG) -T kwbimage \
		-a $(TEXT_BASE) -e $(TEXT_BASE) -d $< $@

332
$(obj)u-boot.sha1:	$(obj)u-boot.bin
333
		$(obj)tools/ubsha1 $(obj)u-boot.bin
334

335
$(obj)u-boot.dis:	$(obj)u-boot
wdenk's avatar
wdenk committed
336
337
		$(OBJDUMP) -d $< > $@

338
GEN_UBOOT = \
Wolfgang Denk's avatar
Wolfgang Denk committed
339
340
		UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
		sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
341
342
		cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
343
			-Map u-boot.map -o u-boot
344
$(obj)u-boot:	depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
345
346
		$(GEN_UBOOT)
ifeq ($(CONFIG_KALLSYMS),y)
347
348
349
350
		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
351
352
		$(GEN_UBOOT) $(obj)common/system_map.o
endif
wdenk's avatar
wdenk committed
353

354
$(OBJS):	depend
355
356
		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))

357
$(LIBS):	depend $(SUBDIRS)
358
		$(MAKE) -C $(dir $(subst $(obj),,$@))
wdenk's avatar
wdenk committed
359

360
$(LIBBOARD):	depend $(LIBS)
Wolfgang Denk's avatar
Wolfgang Denk committed
361
362
		$(MAKE) -C $(dir $(subst $(obj),,$@))

363
$(SUBDIRS):	depend
wdenk's avatar
wdenk committed
364
		$(MAKE) -C $@ all
wdenk's avatar
wdenk committed
365

366
$(LDSCRIPT):	depend
367
368
		$(MAKE) -C $(dir $@) $(notdir $@)

369
370
371
$(obj)u-boot.lds: $(LDSCRIPT)
		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@

372
$(NAND_SPL):	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
373
		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
374

375
$(U_BOOT_NAND):	$(NAND_SPL) $(obj)u-boot.bin
376
		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
377

378
$(ONENAND_IPL):	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
Stefan Roese's avatar
Stefan Roese committed
379
		$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
380

381
$(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin
Kyungmin Park's avatar
Kyungmin Park committed
382
		cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
383

384
$(VERSION_FILE):
385
		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
386
		 '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > $@.tmp
387
		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
388

389
390
391
392
$(TIMESTAMP_FILE):
		@date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
		@date +'#define U_BOOT_TIME "%T"' >> $@

393
gdbtools:
394
395
396
397
398
399
		$(MAKE) -C tools/gdb all || exit 1

updater:
		$(MAKE) -C tools/updater all || exit 1

env:
400
		$(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1
401

402
depend dep:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
403
		for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir _depend ; done
wdenk's avatar
wdenk committed
404

405
406
407
408
409
410
411
412
TAG_SUBDIRS += include
TAG_SUBDIRS += lib_generic board/$(BOARDDIR)
TAG_SUBDIRS += cpu/$(CPU)
TAG_SUBDIRS += lib_$(ARCH)
TAG_SUBDIRS += fs/cramfs
TAG_SUBDIRS += fs/fat
TAG_SUBDIRS += fs/fdos
TAG_SUBDIRS += fs/jffs2
413
TAG_SUBDIRS += fs/yaffs2
414
415
416
417
418
TAG_SUBDIRS += net
TAG_SUBDIRS += disk
TAG_SUBDIRS += common
TAG_SUBDIRS += drivers/bios_emulator
TAG_SUBDIRS += drivers/block
419
TAG_SUBDIRS += drivers/gpio
420
421
422
423
TAG_SUBDIRS += drivers/hwmon
TAG_SUBDIRS += drivers/i2c
TAG_SUBDIRS += drivers/input
TAG_SUBDIRS += drivers/misc
424
TAG_SUBDIRS += drivers/mmc
425
426
427
TAG_SUBDIRS += drivers/mtd
TAG_SUBDIRS += drivers/mtd/nand
TAG_SUBDIRS += drivers/mtd/onenand
Haavard Skinnemoen's avatar
Haavard Skinnemoen committed
428
TAG_SUBDIRS += drivers/mtd/spi
429
430
431
432
433
434
435
TAG_SUBDIRS += drivers/net
TAG_SUBDIRS += drivers/net/sk98lin
TAG_SUBDIRS += drivers/pci
TAG_SUBDIRS += drivers/pcmcia
TAG_SUBDIRS += drivers/qe
TAG_SUBDIRS += drivers/rtc
TAG_SUBDIRS += drivers/serial
436
TAG_SUBDIRS += drivers/spi
437
438
439
TAG_SUBDIRS += drivers/usb
TAG_SUBDIRS += drivers/video

440
tags ctags:
441
		ctags -w -o $(obj)ctags `find $(SUBDIRS) $(TAG_SUBDIRS) \
Wolfgang Denk's avatar
Wolfgang Denk committed
442
						-name '*.[ch]' -print`
wdenk's avatar
wdenk committed
443
444

etags:
445
		etags -a -o $(obj)etags `find $(SUBDIRS) $(TAG_SUBDIRS) \
Wolfgang Denk's avatar
Wolfgang Denk committed
446
						-name '*.[ch]' -print`
Li Yang's avatar
Li Yang committed
447
448
449
450
cscope:
		find $(SUBDIRS) $(TAG_SUBDIRS) -name '*.[ch]' -print \
						> cscope.files
		cscope -b -q -k
wdenk's avatar
wdenk committed
451

452
453
SYSTEM_MAP = \
		$(NM) $1 | \
wdenk's avatar
wdenk committed
454
		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
455
456
457
		LC_ALL=C sort
$(obj)System.map:	$(obj)u-boot
		@$(call SYSTEM_MAP,$<) > $(obj)System.map
wdenk's avatar
wdenk committed
458

459
460
461
462
463
464
#
# 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.
465
466
$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
	@$(XECHO) Generating $@ ; \
467
	set -e ; \
468
	: Generate the dependancies ; \
469
	$(CC) -x c -DDO_DEPS_ONLY -M $(HOSTCFLAGS) $(CPPFLAGS) \
470
471
472
473
474
		-MQ $(obj)include/autoconf.mk include/common.h > $@

$(obj)include/autoconf.mk: $(obj)include/config.h
	@$(XECHO) Generating $@ ; \
	set -e ; \
475
	: Extract the config macros ; \
476
	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
477
478
		sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
	mv $@.tmp $@
479

wdenk's avatar
wdenk committed
480
#########################################################################
481
else	# !config.mk
482
483
all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
484
$(SUBDIRS) $(TIMESTAMP_FILE) $(VERSION_FILE) gdbtools updater env depend \
Li Yang's avatar
Li Yang committed
485
dep tags ctags etags cscope $(obj)System.map:
wdenk's avatar
wdenk committed
486
487
	@echo "System not configured - see README" >&2
	@ exit 1
488
endif	# config.mk
wdenk's avatar
wdenk committed
489

490
491
.PHONY : CHANGELOG
CHANGELOG:
492
493
	git log --no-merges U-Boot-1_1_5.. | \
	unexpand -a | sed -e 's/\s\s*$$//' > $@
494

495
496
include/license.h: tools/bin2header COPYING
	 cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
wdenk's avatar
wdenk committed
497
498
499
#########################################################################

unconfig:
500
	@rm -f $(obj)include/config.h $(obj)include/config.mk \
501
502
		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
wdenk's avatar
wdenk committed
503

504
505
506
%: %_config
	$(MAKE)

wdenk's avatar
wdenk committed
507
508
509
#========================================================================
# PowerPC
#========================================================================
510
511
512
513
514

#########################################################################
## MPC5xx Systems
#########################################################################

wdenk's avatar
wdenk committed
515
canmb_config:	unconfig
516
	@$(MKCONFIG) -a canmb ppc mpc5xxx canmb
wdenk's avatar
wdenk committed
517

518
cmi_mpc5xx_config:	unconfig
519
	@$(MKCONFIG) $(@:_config=) ppc mpc5xx cmi
520

521
PATI_config:		unconfig
522
	@$(MKCONFIG) $(@:_config=) ppc mpc5xx pati mpl
wdenk's avatar
wdenk committed
523

524
525
526
#########################################################################
## MPC5xxx Systems
#########################################################################
wdenk's avatar
wdenk committed
527

528
aev_config: unconfig
529
	@$(MKCONFIG) -a aev ppc mpc5xxx tqm5200 tqc
530

dzu@denx.de's avatar
dzu@denx.de committed
531
BC3450_config:	unconfig
532
	@$(MKCONFIG) -a BC3450 ppc mpc5xxx bc3450
dzu@denx.de's avatar
dzu@denx.de committed
533

534
535
536
cm5200_config:	unconfig
	@$(MKCONFIG) -a cm5200 ppc mpc5xxx cm5200

537
cpci5200_config:  unconfig
538
	@$(MKCONFIG) -a cpci5200  ppc mpc5xxx cpci5200 esd
539

540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
digsy_mtc_config \
digsy_mtc_LOWBOOT_config	\
digsy_mtc_RAMBOOT_config:	unconfig
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/digsy_mtc
	@ >$(obj)include/config.h
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
		{ echo "TEXT_BASE = 0xFF000000" >$(obj)board/digsy_mtc/config.tmp ; \
		  echo "... with LOWBOOT configuration" ; \
		}
	@[ -z "$(findstring RAMBOOT_,$@)" ] || \
		{ echo "TEXT_BASE = 0x00100000" >$(obj)board/digsy_mtc/config.tmp ; \
		  echo "... with RAMBOOT configuration" ; \
		}
	@$(MKCONFIG) -a digsy_mtc  ppc mpc5xxx digsy_mtc

556
557
558
559
560
561
galaxy5200_LOWBOOT_config \
galaxy5200_config:	unconfig
	@mkdir -p $(obj)include
	@echo "#define CONFIG_$(@:_config=) 1" >$(obj)include/config.h
	@$(MKCONFIG) -a galaxy5200 ppc mpc5xxx galaxy5200

562
hmi1001_config:	unconfig
563
	@$(MKCONFIG) hmi1001 ppc mpc5xxx hmi1001
wdenk's avatar
wdenk committed
564

565
566
567
568
569
570
Lite5200_config				\
Lite5200_LOWBOOT_config			\
Lite5200_LOWBOOT08_config		\
icecube_5200_config			\
icecube_5200_LOWBOOT_config		\
icecube_5200_LOWBOOT08_config		\
Wolfgang Denk's avatar
Wolfgang Denk committed
571
572
icecube_5200_DDR_config			\
icecube_5200_DDR_LOWBOOT_config		\
573
574
icecube_5200_DDR_LOWBOOT08_config	\
icecube_5100_config:			unconfig
575
576
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/icecube
wdenk's avatar
wdenk committed
577
578
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
		{ if [ "$(findstring DDR,$@)" ] ; \
579
580
			then echo "TEXT_BASE = 0xFF800000" >$(obj)board/icecube/config.tmp ; \
			else echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; \
wdenk's avatar
wdenk committed
581
		  fi ; \
582
		  $(XECHO) "... with LOWBOOT configuration" ; \
wdenk's avatar
wdenk committed
583
584
		}
	@[ -z "$(findstring LOWBOOT08,$@)" ] || \
585
		{ echo "TEXT_BASE = 0xFF800000" >$(obj)board/icecube/config.tmp ; \
wdenk's avatar
wdenk committed
586
		  echo "... with 8 MB flash only" ; \
587
		  $(XECHO) "... with LOWBOOT configuration" ; \
wdenk's avatar
wdenk committed
588
		}
589
	@[ -z "$(findstring DDR,$@)" ] || \
590
		{ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h ; \
591
		  $(XECHO) "... DDR memory revision" ; \
592
		}
wdenk's avatar
wdenk committed
593
	@[ -z "$(findstring 5200,$@)" ] || \
594
		{ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h ; \
595
		  $(XECHO) "... with MPC5200 processor" ; \
wdenk's avatar
wdenk committed
596
		}
wdenk's avatar
wdenk committed
597
	@[ -z "$(findstring 5100,$@)" ] || \
598
		{ echo "#define CONFIG_MGT5100"		>>$(obj)include/config.h ; \
599
		  $(XECHO) "... with MGT5100 processor" ; \
600
		}
601
	@$(MKCONFIG) -a IceCube ppc mpc5xxx icecube
602

603
jupiter_config:	unconfig
604
605
	@$(MKCONFIG) jupiter ppc mpc5xxx jupiter

606
inka4x0_config:	unconfig
607
	@$(MKCONFIG) inka4x0 ppc mpc5xxx inka4x0
wdenk's avatar
wdenk committed
608

609
lite5200b_config	\
610
lite5200b_PM_config	\
611
lite5200b_LOWBOOT_config:	unconfig
612
613
614
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/icecube
	@ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h
615
	@ $(XECHO) "... DDR memory revision"
616
617
	@ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h
	@ echo "#define CONFIG_LITE5200B"	>>$(obj)include/config.h
618
619
	@[ -z "$(findstring _PM_,$@)" ] || \
		{ echo "#define CONFIG_LITE5200B_PM"	>>$(obj)include/config.h ; \
620
		  $(XECHO) "... with power management (low-power mode) support" ; \
621
		}
622
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
623
		{ echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; \
624
		  $(XECHO) "... with LOWBOOT configuration" ; \
625
		}
626
	@ $(XECHO) "... with MPC5200B processor"
627
	@$(MKCONFIG) -a IceCube  ppc mpc5xxx icecube
628

629
mcc200_config	\
630
631
632
633
mcc200_SDRAM_config	\
mcc200_highboot_config	\
mcc200_COM12_config	\
mcc200_COM12_SDRAM_config	\
634
635
mcc200_COM12_highboot_config	\
mcc200_COM12_highboot_SDRAM_config	\
636
637
638
639
640
mcc200_highboot_SDRAM_config	\
prs200_config	\
prs200_DDR_config	\
prs200_highboot_config	\
prs200_highboot_DDR_config:	unconfig
641
642
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/mcc200
643
	@[ -n "$(findstring highboot,$@)" ] || \
644
		{ $(XECHO) "... with lowboot configuration" ; \
645
		}
646
	@[ -z "$(findstring highboot,$@)" ] || \
647
		{ echo "TEXT_BASE = 0xFFF00000" >$(obj)board/mcc200/config.tmp ; \
648
		  $(XECHO) "... with highboot configuration" ; \
649
650
		}
	@[ -n "$(findstring _SDRAM,$@)" ] || \
651
652
		{ if [ -n "$(findstring mcc200,$@)" ]; \
		  then \
653
			$(XECHO) "... with DDR" ; \
654
655
656
		  else \
			if [ -n "$(findstring _DDR,$@)" ];\
			then \
657
				$(XECHO) "... with DDR" ; \
658
			else \
659
				echo "#define CONFIG_MCC200_SDRAM" >>$(obj)include/config.h ;\
660
				$(XECHO) "... with SDRAM" ; \
661
662
			fi; \
		  fi; \
663
664
		}
	@[ -z "$(findstring _SDRAM,$@)" ] || \
665
		{ echo "#define CONFIG_MCC200_SDRAM"	>>$(obj)include/config.h ; \
666
		  $(XECHO) "... with SDRAM" ; \
667
		}
668
	@[ -z "$(findstring COM12,$@)" ] || \
669
		{ echo "#define CONFIG_CONSOLE_COM12"	>>$(obj)include/config.h ; \
670
		  $(XECHO) "... with console on COM12" ; \
671
		}
672
	@[ -z "$(findstring prs200,$@)" ] || \
673
		{ echo "#define CONFIG_PRS200"	>>$(obj)include/config.h ;\
674
		}
675
	@$(MKCONFIG) -n $@ -a mcc200 ppc mpc5xxx mcc200
676

677
mecp5200_config:  unconfig
678
	@$(MKCONFIG) mecp5200  ppc mpc5xxx mecp5200 esd
679

680
681
682
motionpro_config:	unconfig
	@$(MKCONFIG) motionpro ppc mpc5xxx motionpro

683
684
685
mucmc52_config:		unconfig
	@$(MKCONFIG) mucmc52 ppc mpc5xxx mucmc52

686
munices_config:	unconfig
687
	@$(MKCONFIG) munices ppc mpc5xxx munices
688

689
690
691
692
693
694
695
696
MVBC_P_config: unconfig
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/mvbc_p
	@ >$(obj)include/config.h
	@[ -z "$(findstring MVBC_P,$@)" ] || \
	{   	echo "#define CONFIG_MVBC_P" 	>>$(obj)include/config.h; }
	@$(MKCONFIG) -n $@ -a MVBC_P ppc mpc5xxx mvbc_p matrix_vision

697
o2dnt_config:	unconfig
698
	@$(MKCONFIG) o2dnt ppc mpc5xxx o2dnt
699

700
701
pcm030_config \
pcm030_LOWBOOT_config:	unconfig
702
	@mkdir -p $(obj)include $(obj)board/phytec/pcm030
703
	@ >$(obj)include/config.h
704
705
706
707
708
709
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
		{ echo "TEXT_BASE = 0xFF000000"	>$(obj)board/phytec/pcm030/config.tmp ; \
		  echo "... with LOWBOOT configuration" ; \
		}
	@$(MKCONFIG) -a pcm030 ppc mpc5xxx pcm030 phytec

710
pf5200_config:	unconfig
711
	@$(MKCONFIG) pf5200  ppc mpc5xxx pf5200 esd
712

wdenk's avatar
wdenk committed
713
714
715
716
PM520_config \
PM520_DDR_config \
PM520_ROMBOOT_config \
PM520_ROMBOOT_DDR_config:	unconfig
717
	@mkdir -p $(obj)include
wdenk's avatar
wdenk committed
718
	@[ -z "$(findstring DDR,$@)" ] || \
719
		{ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h ; \
720
		  $(XECHO) "... DDR memory revision" ; \
wdenk's avatar
wdenk committed
721
722
		}
	@[ -z "$(findstring ROMBOOT,$@)" ] || \
723
		{ echo "#define CONFIG_BOOT_ROM" >>$(obj)include/config.h ; \
724
		  $(XECHO) "... booting from 8-bit flash" ; \
wdenk's avatar
wdenk committed
725
		}
726
	@$(MKCONFIG) -a PM520 ppc mpc5xxx pm520
wdenk's avatar
wdenk committed
727

728
smmaco4_config: unconfig
729
	@$(MKCONFIG) -a smmaco4 ppc mpc5xxx tqm5200 tqc
730
731

spieval_config:	unconfig
732
	@$(MKCONFIG) -a spieval ppc mpc5xxx tqm5200 tqc
733

734
TB5200_B_config \
Wolfgang Denk's avatar
Wolfgang Denk committed
735
TB5200_config:	unconfig
736
	@mkdir -p $(obj)include
737
	@[ -z "$(findstring _B,$@)" ] || \
738
		{ echo "#define CONFIG_TQM5200_B"	>>$(obj)include/config.h ; \
739
		  $(XECHO) "... with MPC5200B processor" ; \
740
		}
741
	@$(MKCONFIG) -n $@ -a TB5200 ppc mpc5xxx tqm5200 tqc
Wolfgang Denk's avatar
Wolfgang Denk committed
742

wdenk's avatar
wdenk committed
743
744
745
MINI5200_config	\
EVAL5200_config	\
TOP5200_config:	unconfig
746
747
748
	@mkdir -p $(obj)include
	@ echo "#define CONFIG_$(@:_config=) 1"	>$(obj)include/config.h
	@$(MKCONFIG) -n $@ -a TOP5200 ppc mpc5xxx top5200 emk
wdenk's avatar
wdenk committed
749

wdenk's avatar
wdenk committed
750
751
752
753
754
Total5100_config		\
Total5200_config		\
Total5200_lowboot_config	\
Total5200_Rev2_config		\
Total5200_Rev2_lowboot_config:	unconfig
755
756
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/total5200
wdenk's avatar
wdenk committed
757
	@[ -z "$(findstring 5100,$@)" ] || \
758
		{ echo "#define CONFIG_MGT5100"		>>$(obj)include/config.h ; \
759
		  $(XECHO) "... with MGT5100 processor" ; \
wdenk's avatar
wdenk committed
760
761
		}
	@[ -z "$(findstring 5200,$@)" ] || \
762
		{ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h ; \
763
		  $(XECHO) "... with MPC5200 processor" ; \
wdenk's avatar
wdenk committed
764
765
		}
	@[ -n "$(findstring Rev,$@)" ] || \
766
		{ echo "#define CONFIG_TOTAL5200_REV 1"	>>$(obj)include/config.h ; \
767
		  $(XECHO) "... revision 1 board" ; \
wdenk's avatar
wdenk committed
768
769
		}
	@[ -z "$(findstring Rev2_,$@)" ] || \
770
		{ echo "#define CONFIG_TOTAL5200_REV 2"	>>$(obj)include/config.h ; \
771
		  $(XECHO) "... revision 2 board" ; \
wdenk's avatar
wdenk committed
772
773
		}
	@[ -z "$(findstring lowboot_,$@)" ] || \
774
		{ echo "TEXT_BASE = 0xFE000000" >$(obj)board/total5200/config.tmp ; \
775
		  $(XECHO) "... with lowboot configuration" ; \
wdenk's avatar
wdenk committed
776
		}
777
	@$(MKCONFIG) -a Total5200 ppc mpc5xxx total5200
wdenk's avatar
wdenk committed
778

779
cam5200_config \
780
cam5200_niosflash_config \
Wolfgang Denk's avatar
Wolfgang Denk committed
781
fo300_config \
782
MiniFAP_config \
783
784
TQM5200S_config \
TQM5200S_HIGHBOOT_config \
Wolfgang Denk's avatar
Wolfgang Denk committed
785
786
787
788
TQM5200_B_config \
TQM5200_B_HIGHBOOT_config \
TQM5200_config	\
TQM5200_STK100_config:	unconfig
789
	@mkdir -p $(obj)include
790
	@mkdir -p $(obj)board/tqc/tqm5200
791
	@[ -z "$(findstring cam5200,$@)" ] || \
792
793
794
		{ echo "#define CONFIG_CAM5200"	>>$(obj)include/config.h ; \
		  echo "#define CONFIG_TQM5200S"	>>$(obj)include/config.h ; \
		  echo "#define CONFIG_TQM5200_B"	>>$(obj)include/config.h ; \
795
		  $(XECHO) "... TQM5200S on Cam5200" ; \
796
		}
797
798
	@[ -z "$(findstring niosflash,$@)" ] || \
		{ echo "#define CONFIG_CAM5200_NIOSFLASH"	>>$(obj)include/config.h ; \
799
		  $(XECHO) "... with NIOS flash driver" ; \
800
		}
801
	@[ -z "$(findstring fo300,$@)" ] || \
802
		{ echo "#define CONFIG_FO300"	>>$(obj)include/config.h ; \
803
		  $(XECHO) "... TQM5200 on FO300" ; \
804
		}
wdenk's avatar
wdenk committed
805
	@[ -z "$(findstring MiniFAP,$@)" ] || \
806
		{ echo "#define CONFIG_MINIFAP"	>>$(obj)include/config.h ; \
807
		  $(XECHO) "... TQM5200_AC on MiniFAP" ; \
wdenk's avatar
wdenk committed
808
		}
Wolfgang Denk's avatar
Wolfgang Denk committed
809
	@[ -z "$(findstring STK100,$@)" ] || \
810
		{ echo "#define CONFIG_STK52XX_REV100"	>>$(obj)include/config.h ; \
811
		  $(XECHO) "... on a STK52XX.100 base board" ; \
wdenk's avatar
wdenk committed
812
		}
813
	@[ -z "$(findstring TQM5200_B,$@)" ] || \
814
		{ echo "#define CONFIG_TQM5200_B"	>>$(obj)include/config.h ; \
815
816
		}
	@[ -z "$(findstring TQM5200S,$@)" ] || \
817
818
		{ echo "#define CONFIG_TQM5200S"	>>$(obj)include/config.h ; \
		  echo "#define CONFIG_TQM5200_B"	>>$(obj)include/config.h ; \
819
		}
820
	@[ -z "$(findstring HIGHBOOT,$@)" ] || \
821
		{ echo "TEXT_BASE = 0xFFF00000" >$(obj)board/tqm5200/config.tmp ; \
822
		}
823
	@$(MKCONFIG) -n $@ -a TQM5200 ppc mpc5xxx tqm5200 tqc
824

825
uc101_config:		unconfig
826
	@$(MKCONFIG) uc101 ppc mpc5xxx uc101
827

828
829
v38b_config: unconfig
	@$(MKCONFIG) -a v38b ppc mpc5xxx v38b
wdenk's avatar
wdenk committed
830

831
832
833
#########################################################################
## MPC512x Systems
#########################################################################
834

835
836
837
aria_config:	unconfig
	@$(MKCONFIG) -a aria ppc mpc512x aria davedenx

838
839
840
mecp5123_config:	unconfig
	@$(MKCONFIG) -a mecp5123 ppc mpc512x mecp5123 esd

841
842
mpc5121ads_config \
mpc5121ads_rev2_config	\
843
	: unconfig
Wolfgang Denk's avatar
Wolfgang Denk committed
844
	@mkdir -p $(obj)include
845
846
	@if [ "$(findstring rev2,$@)" ] ; then \
		echo "#define CONFIG_ADS5121_REV2 1" > $(obj)include/config.h; \
John Rigby's avatar
John Rigby committed
847
	fi
848
	@$(MKCONFIG) -a mpc5121ads ppc mpc512x mpc5121ads freescale
849

wdenk's avatar
wdenk committed
850
851
852
853
#########################################################################
## MPC8xx Systems
#########################################################################

854
Adder_config	\
wdenk's avatar
wdenk committed
855
Adder87x_config \
856
AdderII_config	\
wdenk's avatar
wdenk committed
857
	:		unconfig
858
	@mkdir -p $(obj)include
wdenk's avatar
wdenk committed
859
	$(if $(findstring AdderII,$@), \
860
861
	@echo "#define CONFIG_MPC852T" > $(obj)include/config.h)
	@$(MKCONFIG) -a Adder ppc mpc8xx adder
wdenk's avatar
wdenk committed
862