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