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