xref: /rk3399_rockchip-uboot/examples/standalone/Makefile (revision 65f6f07b72a71b83d775c4d20d7ebcd6b2d2086d)
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 ($(SOC),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
89ELF	+= atmel_df_pow2
90SREC	+= atmel_df_pow2.srec
91BIN	+= atmel_df_pow2.bin
92
93ifeq ($(CPU),mpc8xx)
94ELF	+= test_burst
95SREC	+= test_burst.srec
96BIN	+= test_burst.bin
97endif
98
99ifeq ($(ARCH),i386)
100ELF	+= 82559_eeprom
101SREC	+= 82559_eeprom.srec
102BIN	+= 82559_eeprom.bin
103endif
104
105ifeq ($(ARCH),ppc)
106ELF	+= sched
107SREC	+= sched.srec
108BIN	+= sched.bin
109endif
110
111ifeq ($(ARCH),blackfin)
112BFIN_BIN = smc91111_eeprom smc911x_eeprom
113ELF	+= $(BFIN_BIN)
114SREC	+= $(addsuffix .srec,$(BFIN_BIN))
115BIN	+= $(addsuffix .bin,$(BFIN_BIN))
116endif
117
118# The following example is pretty 8xx specific...
119ifeq ($(CPU),mpc8xx)
120ELF	+= timer
121SREC	+= timer.srec
122BIN	+= timer.bin
123endif
124
125# The following example is 8260 specific...
126ifeq ($(CPU),mpc8260)
127ELF	+= mem_to_mem_idma2intr
128SREC	+= mem_to_mem_idma2intr.srec
129BIN	+= mem_to_mem_idma2intr.bin
130endif
131
132# Demo for 52xx IRQs
133ifeq ($(CPU),mpc5xxx)
134ELF	+= interrupt
135SREC	+= interrupt.srec
136BIN	+= interrupt.bin
137endif
138
139# Utility for resetting i82559 EEPROM
140ifeq ($(BOARD),oxc)
141ELF	+= eepro100_eeprom
142SREC	+= eepro100_eeprom.srec
143BIN	+= eepro100_eeprom.bin
144endif
145
146ifeq ($(BIG_ENDIAN),y)
147EX_LDFLAGS += -EB
148endif
149
150COBJS	:= $(SREC:.srec=.o)
151
152LIB	= $(obj)libstubs.a
153LIBAOBJS=
154ifeq ($(ARCH),ppc)
155LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
156endif
157ifeq ($(CPU),mpc8xx)
158LIBAOBJS+= test_burst_lib.o
159endif
160LIBCOBJS= stubs.o
161
162LIBOBJS	= $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
163
164SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S))
165OBJS	:= $(addprefix $(obj),$(COBJS))
166ELF	:= $(addprefix $(obj),$(ELF))
167BIN	:= $(addprefix $(obj),$(BIN))
168SREC	:= $(addprefix $(obj),$(SREC))
169
170gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
171clibdir := $(shell dirname `$(CC) $(CFLAGS) -print-file-name=libc.a`)
172
173CPPFLAGS += -I..
174
175all:	$(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
176
177#########################################################################
178$(LIB):	$(obj).depend $(LIBOBJS)
179		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
180
181$(ELF):
182$(obj)%:	$(obj)%.o $(LIB)
183		$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
184			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
185			-L$(gcclibdir) -lgcc
186
187$(SREC):
188$(obj)%.srec:	$(obj)%
189		$(OBJCOPY) -O srec $< $@ 2>/dev/null
190
191$(BIN):
192$(obj)%.bin:	$(obj)%
193		$(OBJCOPY) -O binary $< $@ 2>/dev/null
194
195#########################################################################
196
197# defines $(obj).depend target
198include $(SRCTREE)/rules.mk
199
200sinclude $(obj).depend
201
202#########################################################################
203