xref: /openbmc/u-boot/examples/Makefile (revision 8206bfae)
1#
2# (C) Copyright 2000-2006
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
24ifeq ($(ARCH),ppc)
25LOAD_ADDR = 0x40000
26endif
27
28ifeq ($(ARCH),i386)
29LOAD_ADDR = 0x40000
30endif
31
32ifeq ($(ARCH),arm)
33ifeq ($(BOARD),omap2420h4)
34LOAD_ADDR = 0x80300000
35else
36ifeq ($(CPU),omap3)
37LOAD_ADDR = 0x80300000
38else
39LOAD_ADDR = 0xc100000
40endif
41endif
42endif
43
44ifeq ($(ARCH),mips)
45LOAD_ADDR = 0x80200000 -T mips.lds
46endif
47
48ifeq ($(ARCH),nios)
49LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds
50endif
51
52ifeq ($(ARCH),nios2)
53LOAD_ADDR = 0x02000000 -L $(gcclibdir) -T nios2.lds
54endif
55
56ifeq ($(ARCH),m68k)
57LOAD_ADDR = 0x20000  -L $(clibdir)
58endif
59
60ifeq ($(ARCH),microblaze)
61LOAD_ADDR = 0x80F00000
62endif
63
64ifeq ($(ARCH),blackfin)
65LOAD_ADDR = 0x1000
66endif
67
68ifeq ($(ARCH),avr32)
69LOAD_ADDR = 0x00000000
70endif
71
72ifeq ($(ARCH),sh)
73LOAD_ADDR = 0x8C000000
74ifeq ($(CPU),sh2)
75BIG_ENDIAN=y
76endif
77endif
78
79ifeq ($(ARCH),sparc)
80LOAD_ADDR = 0x00000000 -L $(gcclibdir) -T sparc.lds
81endif
82
83include $(TOPDIR)/config.mk
84
85ELF	= hello_world
86SREC	= hello_world.srec
87BIN	= hello_world.bin
88
89ifeq ($(CPU),mpc8xx)
90ELF	+= test_burst
91SREC	+= test_burst.srec
92BIN	+= test_burst.bin
93endif
94
95ifeq ($(ARCH),i386)
96ELF	+= 82559_eeprom
97SREC	+= 82559_eeprom.srec
98BIN	+= 82559_eeprom.bin
99endif
100
101ifeq ($(ARCH),ppc)
102ELF	+= sched
103SREC	+= sched.srec
104BIN	+= sched.bin
105endif
106
107ifeq ($(ARCH),blackfin)
108BFIN_BIN = smc91111_eeprom smc911x_eeprom
109ELF	+= $(BFIN_BIN)
110SREC	+= $(addsuffix .srec,$(BFIN_BIN))
111BIN	+= $(addsuffix .bin,$(BFIN_BIN))
112endif
113
114# The following example is pretty 8xx specific...
115ifeq ($(CPU),mpc8xx)
116ELF	+= timer
117SREC	+= timer.srec
118BIN	+= timer.bin
119endif
120
121# The following example is 8260 specific...
122ifeq ($(CPU),mpc8260)
123ELF	+= mem_to_mem_idma2intr
124SREC	+= mem_to_mem_idma2intr.srec
125BIN	+= mem_to_mem_idma2intr.bin
126endif
127
128# Demo for 52xx IRQs
129ifeq ($(CPU),mpc5xxx)
130ELF	+= interrupt
131SREC	+= interrupt.srec
132BIN	+= interrupt.bin
133endif
134
135# Utility for resetting i82559 EEPROM
136ifeq ($(BOARD),oxc)
137ELF	+= eepro100_eeprom
138SREC	+= eepro100_eeprom.srec
139BIN	+= eepro100_eeprom.bin
140endif
141
142ifeq ($(BIG_ENDIAN),y)
143EX_LDFLAGS += -EB
144endif
145
146COBJS	:= $(SREC:.srec=.o)
147
148LIB	= $(obj)libstubs.a
149LIBAOBJS=
150ifeq ($(ARCH),ppc)
151LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
152endif
153ifeq ($(CPU),mpc8xx)
154LIBAOBJS+= test_burst_lib.o
155endif
156LIBCOBJS= stubs.o
157
158LIBOBJS	= $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
159
160SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S))
161OBJS	:= $(addprefix $(obj),$(COBJS))
162ELF	:= $(addprefix $(obj),$(ELF))
163BIN	:= $(addprefix $(obj),$(BIN))
164SREC	:= $(addprefix $(obj),$(SREC))
165
166gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
167clibdir := $(shell dirname `$(CC) $(CFLAGS) -print-file-name=libc.a`)
168
169CPPFLAGS += -I..
170
171all:	$(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
172
173#########################################################################
174$(LIB):	$(obj).depend $(LIBOBJS)
175		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
176
177$(ELF):
178$(obj)%:	$(obj)%.o $(LIB)
179		$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
180			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
181			-L$(gcclibdir) -lgcc
182
183$(SREC):
184$(obj)%.srec:	$(obj)%
185		$(OBJCOPY) -O srec $< $@ 2>/dev/null
186
187$(BIN):
188$(obj)%.bin:	$(obj)%
189		$(OBJCOPY) -O binary $< $@ 2>/dev/null
190
191#########################################################################
192
193# defines $(obj).depend target
194include $(SRCTREE)/rules.mk
195
196sinclude $(obj).depend
197
198#########################################################################
199