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 60include $(TOPDIR)/config.mk 61 62ELF = hello_world 63SREC = hello_world.srec 64BIN = hello_world.bin 65 66ifeq ($(CPU),mpc8xx) 67ELF = test_burst 68SREC = test_burst.srec 69BIN = test_burst.bin 70endif 71 72ifeq ($(ARCH),i386) 73ELF += 82559_eeprom 74SREC += 82559_eeprom.srec 75BIN += 82559_eeprom.bin 76endif 77 78ifeq ($(ARCH),ppc) 79ELF += sched 80SREC += sched.srec 81BIN += sched.bin 82endif 83 84ifeq ($(ARCH),blackfin) 85ELF += smc91111_eeprom 86SREC += smc91111_eeprom.srec 87BIN += smc91111_eeprom.bin 88endif 89 90# The following example is pretty 8xx specific... 91ifeq ($(CPU),mpc8xx) 92ELF += timer 93SREC += timer.srec 94BIN += timer.bin 95endif 96 97# The following example is 8260 specific... 98ifeq ($(CPU),mpc8260) 99ELF += mem_to_mem_idma2intr 100SREC += mem_to_mem_idma2intr.srec 101BIN += mem_to_mem_idma2intr.bin 102endif 103 104# Demo for 52xx IRQs 105ifeq ($(CPU),mpc5xxx) 106ELF += interrupt 107SREC += interrupt.srec 108BIN += interrupt.bin 109endif 110 111# Utility for resetting i82559 EEPROM 112ifeq ($(BOARD),oxc) 113ELF += eepro100_eeprom 114SREC += eepro100_eeprom.srec 115BIN += eepro100_eeprom.bin 116endif 117 118ifeq ($(BIG_ENDIAN),y) 119EX_LDFLAGS += -EB 120endif 121 122COBJS := $(SREC:.srec=.o) 123 124LIB = $(obj)libstubs.a 125LIBAOBJS= 126ifeq ($(ARCH),ppc) 127LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o 128endif 129ifeq ($(CPU),mpc8xx) 130LIBAOBJS+= test_burst_lib.o 131endif 132LIBCOBJS= stubs.o 133 134LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS)) 135 136SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S)) 137OBJS := $(addprefix $(obj),$(COBJS)) 138ELF := $(addprefix $(obj),$(ELF)) 139BIN := $(addprefix $(obj),$(BIN)) 140SREC := $(addprefix $(obj),$(SREC)) 141 142gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) 143clibdir := $(shell dirname `$(CC) $(CFLAGS) -print-file-name=libc.a`) 144 145CPPFLAGS += -I.. 146 147all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) 148 149######################################################################### 150$(LIB): $(obj).depend $(LIBOBJS) 151 $(AR) $(ARFLAGS) $@ $(LIBOBJS) 152 153$(ELF): 154$(obj)%: $(obj)%.o $(LIB) 155 $(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \ 156 -o $@ -e $(notdir $(<:.o=)) $< $(LIB) \ 157 -L$(gcclibdir) -lgcc 158 159$(SREC): 160$(obj)%.srec: $(obj)% 161 $(OBJCOPY) -O srec $< $@ 2>/dev/null 162 163$(BIN): 164$(obj)%.bin: $(obj)% 165 $(OBJCOPY) -O binary $< $@ 2>/dev/null 166 167######################################################################### 168 169# defines $(obj).depend target 170include $(SRCTREE)/rules.mk 171 172sinclude $(obj).depend 173 174######################################################################### 175