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