Makefile 120 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
Wolfgang Denk's avatar
Wolfgang Denk committed
25
PATCHLEVEL = 08
26
SUBLEVEL =
Wolfgang Denk's avatar
Wolfgang Denk committed
27
EXTRAVERSION = -rc2
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
Ed Swarthout's avatar
Ed Swarthout committed
232
TAG_SUBDIRS += cpu/mpc8xxx
233 234 235
endif
ifeq ($(CPU),mpc86xx)
LIBS += cpu/mpc8xxx/ddr/libddr.a
Ed Swarthout's avatar
Ed Swarthout committed
236
TAG_SUBDIRS += cpu/mpc8xxx
Andy Fleming's avatar
Andy Fleming committed
237
endif
238
LIBS += drivers/rtc/librtc.a
239
LIBS += drivers/serial/libserial.a
240
LIBS += drivers/twserial/libtws.a
241 242 243
LIBS += drivers/usb/gadget/libusb_gadget.a
LIBS += drivers/usb/host/libusb_host.a
LIBS += drivers/usb/musb/libusb_musb.a
244
LIBS += drivers/video/libvideo.a
245
LIBS += drivers/watchdog/libwatchdog.a
wdenk's avatar
wdenk committed
246
LIBS += common/libcommon.a
247
LIBS += libfdt/libfdt.a
248
LIBS += api/libapi.a
249
LIBS += post/libpost.a
250 251

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

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

wdenk's avatar
wdenk committed
257
# Add GCC lib
258 259 260 261 262 263 264 265 266 267 268
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
269

270 271 272 273 274
ifeq ($(CONFIG_NAND_U_BOOT),y)
NAND_SPL = nand_spl
U_BOOT_NAND = $(obj)u-boot-nand.bin
endif

275 276 277 278 279
ifeq ($(CONFIG_ONENAND_U_BOOT),y)
ONENAND_IPL = onenand_ipl
U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
endif

280
__OBJS := $(subst $(obj),,$(OBJS))
Wolfgang Denk's avatar
Wolfgang Denk committed
281
__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
282

283
#########################################################################
wdenk's avatar
wdenk committed
284 285
#########################################################################

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

289
all:		$(ALL)
wdenk's avatar
wdenk committed
290

291
$(obj)u-boot.hex:	$(obj)u-boot
wdenk's avatar
wdenk committed
292 293
		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@

294
$(obj)u-boot.srec:	$(obj)u-boot
295
		$(OBJCOPY) -O srec $< $@
wdenk's avatar
wdenk committed
296

297
$(obj)u-boot.bin:	$(obj)u-boot
wdenk's avatar
wdenk committed
298 299
		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@

300
$(obj)u-boot.ldr:	$(obj)u-boot
301
		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
302
		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
303 304 305 306 307 308 309

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

310
$(obj)u-boot.img:	$(obj)u-boot.bin
311 312
		./tools/mkimage -A $(ARCH) -T firmware -C none \
		-a $(TEXT_BASE) -e 0 \
313
		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
314 315 316
			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
		-d $< $@

317
$(obj)u-boot.sha1:	$(obj)u-boot.bin
318
		$(obj)tools/ubsha1 $(obj)u-boot.bin
319

320
$(obj)u-boot.dis:	$(obj)u-boot
wdenk's avatar
wdenk committed
321 322
		$(OBJDUMP) -d $< > $@

323
GEN_UBOOT = \
Wolfgang Denk's avatar
Wolfgang Denk committed
324 325
		UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
		sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
326 327
		cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
328
			-Map u-boot.map -o u-boot
329
$(obj)u-boot:	depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
330 331
		$(GEN_UBOOT)
ifeq ($(CONFIG_KALLSYMS),y)
332 333 334 335
		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
336 337
		$(GEN_UBOOT) $(obj)common/system_map.o
endif
wdenk's avatar
wdenk committed
338

339
$(OBJS):	depend
340 341
		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))

342
$(LIBS):	depend $(SUBDIRS)
343
		$(MAKE) -C $(dir $(subst $(obj),,$@))
wdenk's avatar
wdenk committed
344

345
$(LIBBOARD):	depend $(LIBS)
Wolfgang Denk's avatar
Wolfgang Denk committed
346 347
		$(MAKE) -C $(dir $(subst $(obj),,$@))

348
$(SUBDIRS):	depend
wdenk's avatar
wdenk committed
349
		$(MAKE) -C $@ all
wdenk's avatar
wdenk committed
350

351
$(LDSCRIPT):	depend
352 353
		$(MAKE) -C $(dir $@) $(notdir $@)

354 355 356
$(obj)u-boot.lds: $(LDSCRIPT)
		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@

357
$(NAND_SPL):	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
358
		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
359

360
$(U_BOOT_NAND):	$(NAND_SPL) $(obj)u-boot.bin
361
		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
362

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

366
$(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin
367
		cat $(obj)onenand_ipl/onenand-ipl-2k.bin $(obj)u-boot.bin > $(obj)u-boot-onenand.bin
368
		cat $(obj)onenand_ipl/onenand-ipl-4k.bin $(obj)u-boot.bin > $(obj)u-boot-flexonenand.bin
369

370
$(VERSION_FILE):
371
		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
372
		 '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > $@.tmp
373
		@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
374

375 376 377 378
$(TIMESTAMP_FILE):
		@date +'#define U_BOOT_DATE "%b %d %C%y"' > $@
		@date +'#define U_BOOT_TIME "%T"' >> $@

379
gdbtools:
380 381 382 383 384 385
		$(MAKE) -C tools/gdb all || exit 1

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

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

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

391 392 393 394 395 396 397 398
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
399
TAG_SUBDIRS += fs/yaffs2
400 401 402 403 404
TAG_SUBDIRS += net
TAG_SUBDIRS += disk
TAG_SUBDIRS += common
TAG_SUBDIRS += drivers/bios_emulator
TAG_SUBDIRS += drivers/block
405
TAG_SUBDIRS += drivers/gpio
406 407 408 409
TAG_SUBDIRS += drivers/hwmon
TAG_SUBDIRS += drivers/i2c
TAG_SUBDIRS += drivers/input
TAG_SUBDIRS += drivers/misc
410
TAG_SUBDIRS += drivers/mmc
411 412 413
TAG_SUBDIRS += drivers/mtd
TAG_SUBDIRS += drivers/mtd/nand
TAG_SUBDIRS += drivers/mtd/onenand
Haavard Skinnemoen's avatar
Haavard Skinnemoen committed
414
TAG_SUBDIRS += drivers/mtd/spi
415 416 417 418 419 420 421
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
422
TAG_SUBDIRS += drivers/spi
423 424 425
TAG_SUBDIRS += drivers/usb
TAG_SUBDIRS += drivers/video

426
tags ctags:
427
		ctags -w -o $(obj)ctags `find $(SUBDIRS) $(TAG_SUBDIRS) \
Wolfgang Denk's avatar
Wolfgang Denk committed
428
						-name '*.[ch]' -print`
wdenk's avatar
wdenk committed
429 430

etags:
431
		etags -a -o $(obj)etags `find $(SUBDIRS) $(TAG_SUBDIRS) \
Wolfgang Denk's avatar
Wolfgang Denk committed
432
						-name '*.[ch]' -print`
Li Yang's avatar
Li Yang committed
433 434 435 436
cscope:
		find $(SUBDIRS) $(TAG_SUBDIRS) -name '*.[ch]' -print \
						> cscope.files
		cscope -b -q -k
wdenk's avatar
wdenk committed
437

438 439
SYSTEM_MAP = \
		$(NM) $1 | \
wdenk's avatar
wdenk committed
440
		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
441 442 443
		LC_ALL=C sort
$(obj)System.map:	$(obj)u-boot
		@$(call SYSTEM_MAP,$<) > $(obj)System.map
wdenk's avatar
wdenk committed
444

445 446 447 448 449 450
#
# 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.
451 452
$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
	@$(XECHO) Generating $@ ; \
453
	set -e ; \
454
	: Generate the dependancies ; \
455
	$(CC) -x c -DDO_DEPS_ONLY -M $(HOSTCFLAGS) $(CPPFLAGS) \
456 457 458 459 460
		-MQ $(obj)include/autoconf.mk include/common.h > $@

$(obj)include/autoconf.mk: $(obj)include/config.h
	@$(XECHO) Generating $@ ; \
	set -e ; \
461
	: Extract the config macros ; \
462
	$(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
463 464
		sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
	mv $@.tmp $@
465

wdenk's avatar
wdenk committed
466
#########################################################################
467
else	# !config.mk
468 469
all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
470
$(SUBDIRS) $(TIMESTAMP_FILE) $(VERSION_FILE) gdbtools updater env depend \
Li Yang's avatar
Li Yang committed
471
dep tags ctags etags cscope $(obj)System.map:
wdenk's avatar
wdenk committed
472 473
	@echo "System not configured - see README" >&2
	@ exit 1
474
endif	# config.mk
wdenk's avatar
wdenk committed
475

476 477
.PHONY : CHANGELOG
CHANGELOG:
478 479
	git log --no-merges U-Boot-1_1_5.. | \
	unexpand -a | sed -e 's/\s\s*$$//' > $@
480

481 482
include/license.h: tools/bin2header COPYING
	 cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
wdenk's avatar
wdenk committed
483 484 485
#########################################################################

unconfig:
486
	@rm -f $(obj)include/config.h $(obj)include/config.mk \
487 488
		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
		$(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep
wdenk's avatar
wdenk committed
489 490 491 492

#========================================================================
# PowerPC
#========================================================================
493 494 495 496 497

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

wdenk's avatar
wdenk committed
498
canmb_config:	unconfig
499
	@$(MKCONFIG) -a canmb ppc mpc5xxx canmb
wdenk's avatar
wdenk committed
500

501
cmi_mpc5xx_config:	unconfig
502
	@$(MKCONFIG) $(@:_config=) ppc mpc5xx cmi
503

504
PATI_config:		unconfig
505
	@$(MKCONFIG) $(@:_config=) ppc mpc5xx pati mpl
wdenk's avatar
wdenk committed
506

507 508 509
#########################################################################
## MPC5xxx Systems
#########################################################################
wdenk's avatar
wdenk committed
510

511
aev_config: unconfig
512
	@$(MKCONFIG) -a aev ppc mpc5xxx tqm5200 tqc
513

dzu@denx.de's avatar
dzu@denx.de committed
514
BC3450_config:	unconfig
515
	@$(MKCONFIG) -a BC3450 ppc mpc5xxx bc3450
dzu@denx.de's avatar
dzu@denx.de committed
516

517 518 519
cm5200_config:	unconfig
	@$(MKCONFIG) -a cm5200 ppc mpc5xxx cm5200

520
cpci5200_config:  unconfig
521
	@$(MKCONFIG) -a cpci5200  ppc mpc5xxx cpci5200 esd
522

523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
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

539
hmi1001_config:	unconfig
540
	@$(MKCONFIG) hmi1001 ppc mpc5xxx hmi1001
wdenk's avatar
wdenk committed
541

542 543 544 545 546 547
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
548 549
icecube_5200_DDR_config			\
icecube_5200_DDR_LOWBOOT_config		\
550 551
icecube_5200_DDR_LOWBOOT08_config	\
icecube_5100_config:			unconfig
552 553
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/icecube
wdenk's avatar
wdenk committed
554 555
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
		{ if [ "$(findstring DDR,$@)" ] ; \
556 557
			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
558
		  fi ; \
559
		  $(XECHO) "... with LOWBOOT configuration" ; \
wdenk's avatar
wdenk committed
560 561
		}
	@[ -z "$(findstring LOWBOOT08,$@)" ] || \
562
		{ echo "TEXT_BASE = 0xFF800000" >$(obj)board/icecube/config.tmp ; \
wdenk's avatar
wdenk committed
563
		  echo "... with 8 MB flash only" ; \
564
		  $(XECHO) "... with LOWBOOT configuration" ; \
wdenk's avatar
wdenk committed
565
		}
566
	@[ -z "$(findstring DDR,$@)" ] || \
567
		{ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h ; \
568
		  $(XECHO) "... DDR memory revision" ; \
569
		}
wdenk's avatar
wdenk committed
570
	@[ -z "$(findstring 5200,$@)" ] || \
571
		{ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h ; \
572
		  $(XECHO) "... with MPC5200 processor" ; \
wdenk's avatar
wdenk committed
573
		}
wdenk's avatar
wdenk committed
574
	@[ -z "$(findstring 5100,$@)" ] || \
575
		{ echo "#define CONFIG_MGT5100"		>>$(obj)include/config.h ; \
576
		  $(XECHO) "... with MGT5100 processor" ; \
577
		}
578
	@$(MKCONFIG) -a IceCube ppc mpc5xxx icecube
579

580
jupiter_config:	unconfig
581 582
	@$(MKCONFIG) jupiter ppc mpc5xxx jupiter

583
inka4x0_config:	unconfig
584
	@$(MKCONFIG) inka4x0 ppc mpc5xxx inka4x0
wdenk's avatar
wdenk committed
585

586
lite5200b_config	\
587
lite5200b_PM_config	\
588
lite5200b_LOWBOOT_config:	unconfig
589 590 591
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/icecube
	@ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h
592
	@ $(XECHO) "... DDR memory revision"
593 594
	@ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h
	@ echo "#define CONFIG_LITE5200B"	>>$(obj)include/config.h
595 596
	@[ -z "$(findstring _PM_,$@)" ] || \
		{ echo "#define CONFIG_LITE5200B_PM"	>>$(obj)include/config.h ; \
597
		  $(XECHO) "... with power management (low-power mode) support" ; \
598
		}
599
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
600
		{ echo "TEXT_BASE = 0xFF000000" >$(obj)board/icecube/config.tmp ; \
601
		  $(XECHO) "... with LOWBOOT configuration" ; \
602
		}
603
	@ $(XECHO) "... with MPC5200B processor"
604
	@$(MKCONFIG) -a IceCube  ppc mpc5xxx icecube
605

606
mcc200_config	\
607 608 609 610
mcc200_SDRAM_config	\
mcc200_highboot_config	\
mcc200_COM12_config	\
mcc200_COM12_SDRAM_config	\
611 612
mcc200_COM12_highboot_config	\
mcc200_COM12_highboot_SDRAM_config	\
613 614 615 616 617
mcc200_highboot_SDRAM_config	\
prs200_config	\
prs200_DDR_config	\
prs200_highboot_config	\
prs200_highboot_DDR_config:	unconfig
618 619
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/mcc200
620
	@[ -n "$(findstring highboot,$@)" ] || \
621
		{ $(XECHO) "... with lowboot configuration" ; \
622
		}
623
	@[ -z "$(findstring highboot,$@)" ] || \
624
		{ echo "TEXT_BASE = 0xFFF00000" >$(obj)board/mcc200/config.tmp ; \
625
		  $(XECHO) "... with highboot configuration" ; \
626 627
		}
	@[ -n "$(findstring _SDRAM,$@)" ] || \
628 629
		{ if [ -n "$(findstring mcc200,$@)" ]; \
		  then \
630
			$(XECHO) "... with DDR" ; \
631 632 633
		  else \
			if [ -n "$(findstring _DDR,$@)" ];\
			then \
634
				$(XECHO) "... with DDR" ; \
635
			else \
636
				echo "#define CONFIG_MCC200_SDRAM" >>$(obj)include/config.h ;\
637
				$(XECHO) "... with SDRAM" ; \
638 639
			fi; \
		  fi; \
640 641
		}
	@[ -z "$(findstring _SDRAM,$@)" ] || \
642
		{ echo "#define CONFIG_MCC200_SDRAM"	>>$(obj)include/config.h ; \
643
		  $(XECHO) "... with SDRAM" ; \
644
		}
645
	@[ -z "$(findstring COM12,$@)" ] || \
646
		{ echo "#define CONFIG_CONSOLE_COM12"	>>$(obj)include/config.h ; \
647
		  $(XECHO) "... with console on COM12" ; \
648
		}
649
	@[ -z "$(findstring prs200,$@)" ] || \
650
		{ echo "#define CONFIG_PRS200"	>>$(obj)include/config.h ;\
651
		}
652
	@$(MKCONFIG) -n $@ -a mcc200 ppc mpc5xxx mcc200
653

654
mecp5200_config:  unconfig
655
	@$(MKCONFIG) mecp5200  ppc mpc5xxx mecp5200 esd
656

657 658 659
motionpro_config:	unconfig
	@$(MKCONFIG) motionpro ppc mpc5xxx motionpro

660 661 662
mucmc52_config:		unconfig
	@$(MKCONFIG) mucmc52 ppc mpc5xxx mucmc52

663
munices_config:	unconfig
664
	@$(MKCONFIG) munices ppc mpc5xxx munices
665

666 667 668 669 670 671 672 673
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

674
o2dnt_config:	unconfig
675
	@$(MKCONFIG) o2dnt ppc mpc5xxx o2dnt
676

677 678
pcm030_config \
pcm030_LOWBOOT_config:	unconfig
679
	@mkdir -p $(obj)include $(obj)board/phytec/pcm030
680
	@ >$(obj)include/config.h
681 682 683 684 685 686
	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
		{ echo "TEXT_BASE = 0xFF000000"	>$(obj)board/phytec/pcm030/config.tmp ; \
		  echo "... with LOWBOOT configuration" ; \
		}
	@$(MKCONFIG) -a pcm030 ppc mpc5xxx pcm030 phytec

687
pf5200_config:	unconfig
688
	@$(MKCONFIG) pf5200  ppc mpc5xxx pf5200 esd
689

wdenk's avatar
wdenk committed
690 691 692 693
PM520_config \
PM520_DDR_config \
PM520_ROMBOOT_config \
PM520_ROMBOOT_DDR_config:	unconfig
694
	@mkdir -p $(obj)include
wdenk's avatar
wdenk committed
695
	@[ -z "$(findstring DDR,$@)" ] || \
696
		{ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h ; \
697
		  $(XECHO) "... DDR memory revision" ; \
wdenk's avatar
wdenk committed
698 699
		}
	@[ -z "$(findstring ROMBOOT,$@)" ] || \
700
		{ echo "#define CONFIG_BOOT_ROM" >>$(obj)include/config.h ; \
701
		  $(XECHO) "... booting from 8-bit flash" ; \
wdenk's avatar
wdenk committed
702
		}
703
	@$(MKCONFIG) -a PM520 ppc mpc5xxx pm520
wdenk's avatar
wdenk committed
704

705
smmaco4_config: unconfig
706
	@$(MKCONFIG) -a smmaco4 ppc mpc5xxx tqm5200 tqc
707 708

spieval_config:	unconfig
709
	@$(MKCONFIG) -a spieval ppc mpc5xxx tqm5200 tqc
710

711
TB5200_B_config \
Wolfgang Denk's avatar
Wolfgang Denk committed
712
TB5200_config:	unconfig
713
	@mkdir -p $(obj)include
714
	@[ -z "$(findstring _B,$@)" ] || \
715
		{ echo "#define CONFIG_TQM5200_B"	>>$(obj)include/config.h ; \
716
		  $(XECHO) "... with MPC5200B processor" ; \
717
		}
718
	@$(MKCONFIG) -n $@ -a TB5200 ppc mpc5xxx tqm5200 tqc
Wolfgang Denk's avatar
Wolfgang Denk committed
719

wdenk's avatar
wdenk committed
720 721 722
MINI5200_config	\
EVAL5200_config	\
TOP5200_config:	unconfig
723 724 725
	@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
726

wdenk's avatar
wdenk committed
727 728 729 730 731
Total5100_config		\
Total5200_config		\
Total5200_lowboot_config	\
Total5200_Rev2_config		\
Total5200_Rev2_lowboot_config:	unconfig
732 733
	@mkdir -p $(obj)include
	@mkdir -p $(obj)board/total5200
wdenk's avatar
wdenk committed
734
	@[ -z "$(findstring 5100,$@)" ] || \
735
		{ echo "#define CONFIG_MGT5100"		>>$(obj)include/config.h ; \
736
		  $(XECHO) "... with MGT5100 processor" ; \
wdenk's avatar
wdenk committed
737 738
		}
	@[ -z "$(findstring 5200,$@)" ] || \
739
		{ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h ; \
740
		  $(XECHO) "... with MPC5200 processor" ; \
wdenk's avatar
wdenk committed
741 742
		}
	@[ -n "$(findstring Rev,$@)" ] || \
743
		{ echo "#define CONFIG_TOTAL5200_REV 1"	>>$(obj)include/config.h ; \
744
		  $(XECHO) "... revision 1 board" ; \
wdenk's avatar
wdenk committed
745 746
		}
	@[ -z "$(findstring Rev2_,$@)" ] || \
747
		{ echo "#define CONFIG_TOTAL5200_REV 2"	>>$(obj)include/config.h ; \
748
		  $(XECHO) "... revision 2 board" ; \
wdenk's avatar
wdenk committed
749 750
		}
	@[ -z "$(findstring lowboot_,$@)" ] || \
751
		{ echo "TEXT_BASE = 0xFE000000" >$(obj)board/total5200/config.tmp ; \
752
		  $(XECHO) "... with lowboot configuration" ; \
wdenk's avatar
wdenk committed
753
		}
754
	@$(MKCONFIG) -a Total5200 ppc mpc5xxx total5200
wdenk's avatar
wdenk committed
755

756
cam5200_config \
757
cam5200_niosflash_config \
Wolfgang Denk's avatar
Wolfgang Denk committed
758
fo300_config \
759
MiniFAP_config \
760 761
TQM5200S_config \
TQM5200S_HIGHBOOT_config \
Wolfgang Denk's avatar
Wolfgang Denk committed
762 763 764 765
TQM5200_B_config \
TQM5200_B_HIGHBOOT_config \
TQM5200_config	\
TQM5200_STK100_config:	unconfig
766
	@mkdir -p $(obj)include
767
	@mkdir -p $(obj)board/tqc/tqm5200