]> git.ipfire.org Git - thirdparty/u-boot.git/blame - Makefile
Merge with /home/wd/git/u-boot/master
[thirdparty/u-boot.git] / Makefile
CommitLineData
7ebf7443 1#
881a87ec 2# (C) Copyright 2000-2006
7ebf7443
WD
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# See file CREDITS for list of people who contributed to this
6# project.
7#
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation; either version 2 of
11# the License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21# MA 02111-1307 USA
22#
23
881a87ec
WD
24VERSION = 1
25PATCHLEVEL = 1
26SUBLEVEL = 4
27EXTRAVERSION =
28U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
29VERSION_FILE = include/version_autogenerated.h
30
7ebf7443
WD
31HOSTARCH := $(shell uname -m | \
32 sed -e s/i.86/i386/ \
33 -e s/sun4u/sparc64/ \
34 -e s/arm.*/arm/ \
35 -e s/sa110/arm/ \
36 -e s/powerpc/ppc/ \
37 -e s/macppc/ppc/)
38
f9d77ed3 39HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
7ebf7443
WD
40 sed -e 's/\(cygwin\).*/cygwin/')
41
f9d77ed3 42export HOSTARCH HOSTOS
7ebf7443
WD
43
44# Deal with colliding definitions from tcsh etc.
45VENDOR=
46
47#########################################################################
48
49TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
50export TOPDIR
51
52ifeq (include/config.mk,$(wildcard include/config.mk))
53# load ARCH, BOARD, and CPU configuration
54include include/config.mk
1d9f4105 55export ARCH CPU BOARD VENDOR SOC
7ebf7443
WD
56# load other configuration
57include $(TOPDIR)/config.mk
58
59ifndef CROSS_COMPILE
60ifeq ($(HOSTARCH),ppc)
61CROSS_COMPILE =
62else
7ebf7443 63ifeq ($(ARCH),ppc)
f046ccd1 64CROSS_COMPILE = powerpc-linux-
7ebf7443
WD
65endif
66ifeq ($(ARCH),arm)
dc7c9a1a 67CROSS_COMPILE = arm-linux-
7ebf7443 68endif
2262cfee 69ifeq ($(ARCH),i386)
7a8e9bed
WD
70ifeq ($(HOSTARCH),i386)
71CROSS_COMPILE =
72else
73CROSS_COMPILE = i386-linux-
74endif
2262cfee 75endif
43d9616c
WD
76ifeq ($(ARCH),mips)
77CROSS_COMPILE = mips_4KC-
78endif
4a551709
WD
79ifeq ($(ARCH),nios)
80CROSS_COMPILE = nios-elf-
81endif
5c952cf0
WD
82ifeq ($(ARCH),nios2)
83CROSS_COMPILE = nios2-elf-
84endif
4e5ca3eb
WD
85ifeq ($(ARCH),m68k)
86CROSS_COMPILE = m68k-elf-
87endif
507bbe3e
WD
88ifeq ($(ARCH),microblaze)
89CROSS_COMPILE = mb-
90endif
7ebf7443
WD
91endif
92endif
93
94export CROSS_COMPILE
95
7ebf7443
WD
96#########################################################################
97# U-Boot objects....order is important (i.e. start must be first)
98
9fd5e31f 99OBJS = cpu/$(CPU)/start.o
2262cfee 100ifeq ($(CPU),i386)
9fd5e31f
WD
101OBJS += cpu/$(CPU)/start16.o
102OBJS += cpu/$(CPU)/reset.o
2262cfee 103endif
7ebf7443 104ifeq ($(CPU),ppc4xx)
9fd5e31f 105OBJS += cpu/$(CPU)/resetvec.o
7ebf7443 106endif
f046ccd1
EL
107ifeq ($(CPU),mpc83xx)
108OBJS += cpu/$(CPU)/resetvec.o
109endif
42d1f039
WD
110ifeq ($(CPU),mpc85xx)
111OBJS += cpu/$(CPU)/resetvec.o
112endif
7ebf7443 113
9fd5e31f
WD
114LIBS = lib_generic/libgeneric.a
115LIBS += board/$(BOARDDIR)/lib$(BOARD).a
7ebf7443 116LIBS += cpu/$(CPU)/lib$(CPU).a
1d9f4105
WD
117ifdef SOC
118LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
119endif
7ebf7443 120LIBS += lib_$(ARCH)/lib$(ARCH).a
518e2e1a 121LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
c419d1d6 122 fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
7ebf7443
WD
123LIBS += net/libnet.a
124LIBS += disk/libdisk.a
125LIBS += rtc/librtc.a
126LIBS += dtt/libdtt.a
127LIBS += drivers/libdrivers.a
7152b1d0 128LIBS += drivers/sk98lin/libsk98lin.a
7ebf7443
WD
129LIBS += post/libpost.a post/cpu/libcpu.a
130LIBS += common/libcommon.a
038ccac5 131LIBS += $(BOARDLIBS)
9fd5e31f 132.PHONY : $(LIBS)
a8c7c708 133
4f7cb08e 134# Add GCC lib
1a344f29 135PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
3d3befa7 136
7ebf7443 137
a8c7c708
WD
138# The "tools" are needed early, so put this first
139# Don't include stuff already done in $(LIBS)
140SUBDIRS = tools \
141 examples \
142 post \
143 post/cpu
b028f715 144.PHONY : $(SUBDIRS)
a8c7c708 145
bdccc4fe 146#########################################################################
7ebf7443
WD
147#########################################################################
148
bdccc4fe 149ALL = u-boot.srec u-boot.bin System.map
7ebf7443 150
bdccc4fe 151all: $(ALL)
7ebf7443 152
6310eb9d
WD
153u-boot.hex: u-boot
154 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
155
7ebf7443
WD
156u-boot.srec: u-boot
157 $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
158
159u-boot.bin: u-boot
160 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
161
bdccc4fe
WD
162u-boot.img: u-boot.bin
163 ./tools/mkimage -A $(ARCH) -T firmware -C none \
164 -a $(TEXT_BASE) -e 0 \
881a87ec 165 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
bdccc4fe
WD
166 sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
167 -d $< $@
168
7ebf7443
WD
169u-boot.dis: u-boot
170 $(OBJDUMP) -d $< > $@
171
881a87ec 172u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
8bde7f77
WD
173 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
174 $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
1a344f29 175 --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
b2184c31 176 -Map u-boot.map -o u-boot
7ebf7443 177
a8c7c708
WD
178$(LIBS):
179 $(MAKE) -C `dirname $@`
180
181$(SUBDIRS):
b028f715 182 $(MAKE) -C $@ all
7ebf7443 183
881a87ec
WD
184version:
185 @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
186 echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
187 echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \
188 $(TOPDIR)) >> $(VERSION_FILE); \
189 echo "\"" >> $(VERSION_FILE)
190
8f713fdf 191gdbtools:
192 $(MAKE) -C tools/gdb || exit 1
193
7ebf7443
WD
194depend dep:
195 @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
196
197tags:
198 ctags -w `find $(SUBDIRS) include \
bda6c8ae
WD
199 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
200 fs/cramfs fs/fat fs/fdos fs/jffs2 \
201 net disk rtc dtt drivers drivers/sk98lin common \
7ebf7443
WD
202 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
203
204etags:
205 etags -a `find $(SUBDIRS) include \
eedcd078
WD
206 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
207 fs/cramfs fs/fat fs/fdos fs/jffs2 \
208 net disk rtc dtt drivers drivers/sk98lin common \
7ebf7443
WD
209 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
210