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