blob: bc98120a51fe3abb16b0f66196ad03104b172696 [file] [log] [blame]
wdenk717b5aa2002-04-27 11:09:31 +00001#
Marian Balakowiczf9328632006-09-01 19:49:50 +02002# (C) Copyright 2000-2006
wdenk717b5aa2002-04-27 11:09:31 +00003# 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
wdenk717b5aa2002-04-27 11:09:31 +000024include $(TOPDIR)/config.mk
25
Wolfgang Denk96582982006-10-24 13:55:18 +020026ELF = hello_world
wdenk717b5aa2002-04-27 11:09:31 +000027SREC = hello_world.srec
Wolfgang Denk96582982006-10-24 13:55:18 +020028BIN = hello_world.bin
wdenk717b5aa2002-04-27 11:09:31 +000029
Mike Frysinger65f6f072009-07-23 16:37:03 -040030ELF += atmel_df_pow2
31SREC += atmel_df_pow2.srec
32BIN += atmel_df_pow2.bin
33
wdenkc0176632005-05-16 14:19:49 +000034ifeq ($(CPU),mpc8xx)
Wolfgang Denkdfece952008-03-04 11:58:26 +010035ELF += test_burst
36SREC += test_burst.srec
37BIN += test_burst.bin
wdenk931da932005-05-07 19:06:32 +000038endif
39
wdenk7a8e9bed2003-05-31 18:35:21 +000040ifeq ($(ARCH),i386)
Wolfgang Denk96582982006-10-24 13:55:18 +020041ELF += 82559_eeprom
42SREC += 82559_eeprom.srec
43BIN += 82559_eeprom.bin
wdenk7a8e9bed2003-05-31 18:35:21 +000044endif
45
wdenk85ec0bc2003-03-31 16:34:49 +000046ifeq ($(ARCH),ppc)
Wolfgang Denk96582982006-10-24 13:55:18 +020047ELF += sched
48SREC += sched.srec
49BIN += sched.bin
wdenk85ec0bc2003-03-31 16:34:49 +000050endif
51
Wolfgang Denk0afe5192006-03-12 02:10:00 +010052ifeq ($(ARCH),blackfin)
Mike Frysingerad2d1632008-12-22 02:56:07 -050053BFIN_BIN = smc91111_eeprom smc911x_eeprom
54ELF += $(BFIN_BIN)
55SREC += $(addsuffix .srec,$(BFIN_BIN))
56BIN += $(addsuffix .bin,$(BFIN_BIN))
Aubrey Li26bf7de2007-03-19 01:24:52 +080057endif
Wolfgang Denk0afe5192006-03-12 02:10:00 +010058
wdenk717b5aa2002-04-27 11:09:31 +000059# The following example is pretty 8xx specific...
60ifeq ($(CPU),mpc8xx)
Wolfgang Denk96582982006-10-24 13:55:18 +020061ELF += timer
62SREC += timer.srec
63BIN += timer.bin
wdenk717b5aa2002-04-27 11:09:31 +000064endif
65
wdenk3e386912003-04-05 00:53:31 +000066# The following example is 8260 specific...
67ifeq ($(CPU),mpc8260)
Wolfgang Denk96582982006-10-24 13:55:18 +020068ELF += mem_to_mem_idma2intr
69SREC += mem_to_mem_idma2intr.srec
70BIN += mem_to_mem_idma2intr.bin
wdenk3e386912003-04-05 00:53:31 +000071endif
72
Detlev Zundelec0f7272006-09-01 15:02:06 +020073# Demo for 52xx IRQs
74ifeq ($(CPU),mpc5xxx)
Wolfgang Denk96582982006-10-24 13:55:18 +020075ELF += interrupt
76SREC += interrupt.srec
77BIN += interrupt.bin
Detlev Zundelec0f7272006-09-01 15:02:06 +020078endif
79
wdenk717b5aa2002-04-27 11:09:31 +000080# Utility for resetting i82559 EEPROM
81ifeq ($(BOARD),oxc)
Wolfgang Denk96582982006-10-24 13:55:18 +020082ELF += eepro100_eeprom
83SREC += eepro100_eeprom.srec
84BIN += eepro100_eeprom.bin
wdenk717b5aa2002-04-27 11:09:31 +000085endif
86
wdenk2d5b5612003-10-14 19:43:55 +000087
Marian Balakowiczf9328632006-09-01 19:49:50 +020088COBJS := $(SREC:.srec=.o)
wdenk717b5aa2002-04-27 11:09:31 +000089
Marian Balakowiczf9328632006-09-01 19:49:50 +020090LIB = $(obj)libstubs.a
wdenk27b207f2003-07-24 23:38:38 +000091LIBAOBJS=
wdenk85ec0bc2003-03-31 16:34:49 +000092ifeq ($(ARCH),ppc)
93LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
wdenkc0176632005-05-16 14:19:49 +000094endif
95ifeq ($(CPU),mpc8xx)
wdenk931da932005-05-07 19:06:32 +000096LIBAOBJS+= test_burst_lib.o
wdenk85ec0bc2003-03-31 16:34:49 +000097endif
wdenk27b207f2003-07-24 23:38:38 +000098LIBCOBJS= stubs.o
Marian Balakowiczf9328632006-09-01 19:49:50 +020099
100LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
101
102SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(if $(LIBAOBJS),$(LIBAOBJS:.o=.S))
103OBJS := $(addprefix $(obj),$(COBJS))
Wolfgang Denk96582982006-10-24 13:55:18 +0200104ELF := $(addprefix $(obj),$(ELF))
Marian Balakowiczf9328632006-09-01 19:49:50 +0200105BIN := $(addprefix $(obj),$(BIN))
106SREC := $(addprefix $(obj),$(SREC))
wdenk717b5aa2002-04-27 11:09:31 +0000107
wdenkc29fdfc2003-08-29 20:57:53 +0000108gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
109
wdenk717b5aa2002-04-27 11:09:31 +0000110CPPFLAGS += -I..
111
Wolfgang Denk96582982006-10-24 13:55:18 +0200112all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
wdenk717b5aa2002-04-27 11:09:31 +0000113
114#########################################################################
Marian Balakowiczf9328632006-09-01 19:49:50 +0200115$(LIB): $(obj).depend $(LIBOBJS)
Wolfgang Denk2b208f52006-10-09 01:02:05 +0200116 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
wdenk717b5aa2002-04-27 11:09:31 +0000117
Wolfgang Denk96582982006-10-24 13:55:18 +0200118$(ELF):
Marian Balakowiczf9328632006-09-01 19:49:50 +0200119$(obj)%: $(obj)%.o $(LIB)
Mike Frysinger262ae0a2009-09-03 23:12:47 -0400120 $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
Mike Frysinger0858b832008-02-04 19:26:55 -0500121 -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
Marian Balakowiczf9328632006-09-01 19:49:50 +0200122 -L$(gcclibdir) -lgcc
Wolfgang Denk96582982006-10-24 13:55:18 +0200123
124$(SREC):
Marian Balakowiczf9328632006-09-01 19:49:50 +0200125$(obj)%.srec: $(obj)%
126 $(OBJCOPY) -O srec $< $@ 2>/dev/null
wdenk717b5aa2002-04-27 11:09:31 +0000127
Wolfgang Denk96582982006-10-24 13:55:18 +0200128$(BIN):
Marian Balakowiczf9328632006-09-01 19:49:50 +0200129$(obj)%.bin: $(obj)%
130 $(OBJCOPY) -O binary $< $@ 2>/dev/null
wdenkdc7c9a12003-03-26 06:55:25 +0000131
wdenk717b5aa2002-04-27 11:09:31 +0000132#########################################################################
133
Marian Balakowiczf9328632006-09-01 19:49:50 +0200134# defines $(obj).depend target
135include $(SRCTREE)/rules.mk
wdenk717b5aa2002-04-27 11:09:31 +0000136
Marian Balakowiczf9328632006-09-01 19:49:50 +0200137sinclude $(obj).depend
wdenk717b5aa2002-04-27 11:09:31 +0000138
139#########################################################################