blob: 5e2f2bcaeb45628ef88100faa1d8b351243f3620 [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
Mike Frysingerc0072e62009-09-04 19:54:45 -040026ELF-$(ARCH) :=
27ELF-$(BOARD) :=
28ELF-$(CPU) :=
29ELF-y := hello_world
wdenk717b5aa2002-04-27 11:09:31 +000030
Mike Frysingerc0072e62009-09-04 19:54:45 -040031ELF-$(CONFIG_SMC91111) += smc91111_eeprom
32ELF-$(CONFIG_SMC911X) += smc911x_eeprom
33ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2
34ELF-i386 += 82559_eeprom
35ELF-mpc5xxx += interrupt
36ELF-mpc8xx += test_burst timer
37ELF-mpc8260 += mem_to_mem_idma2intr
38ELF-ppc += sched
39ELF-oxc += eepro100_eeprom
Mike Frysinger2c175272009-07-23 16:37:03 -040040
Mike Frysingerc0072e62009-09-04 19:54:45 -040041ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))
42SREC = $(addsuffix .srec,$(ELF))
43BIN = $(addsuffix .bin,$(ELF))
wdenk931da932005-05-07 19:06:32 +000044
Mike Frysingerc0072e62009-09-04 19:54:45 -040045COBJS := $(ELF:=.o)
wdenk717b5aa2002-04-27 11:09:31 +000046
Marian Balakowiczf9328632006-09-01 19:49:50 +020047LIB = $(obj)libstubs.a
Mike Frysingerc0072e62009-09-04 19:54:45 -040048
49LIBAOBJS-$(ARCH) :=
50LIBAOBJS-$(CPU) :=
51LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
52LIBAOBJS-mpc8xx += test_burst_lib.o
53LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
54
55LIBCOBJS = stubs.o
Marian Balakowiczf9328632006-09-01 19:49:50 +020056
57LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
58
Mike Frysingerc0072e62009-09-04 19:54:45 -040059SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
Marian Balakowiczf9328632006-09-01 19:49:50 +020060OBJS := $(addprefix $(obj),$(COBJS))
Wolfgang Denk96582982006-10-24 13:55:18 +020061ELF := $(addprefix $(obj),$(ELF))
Marian Balakowiczf9328632006-09-01 19:49:50 +020062BIN := $(addprefix $(obj),$(BIN))
63SREC := $(addprefix $(obj),$(SREC))
wdenk717b5aa2002-04-27 11:09:31 +000064
wdenkc29fdfc2003-08-29 20:57:53 +000065gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
66
wdenk717b5aa2002-04-27 11:09:31 +000067CPPFLAGS += -I..
68
Wolfgang Denk96582982006-10-24 13:55:18 +020069all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
wdenk717b5aa2002-04-27 11:09:31 +000070
71#########################################################################
Marian Balakowiczf9328632006-09-01 19:49:50 +020072$(LIB): $(obj).depend $(LIBOBJS)
Wolfgang Denk2b208f52006-10-09 01:02:05 +020073 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
wdenk717b5aa2002-04-27 11:09:31 +000074
Wolfgang Denk96582982006-10-24 13:55:18 +020075$(ELF):
Marian Balakowiczf9328632006-09-01 19:49:50 +020076$(obj)%: $(obj)%.o $(LIB)
Mike Frysinger8eb7e282009-09-03 23:12:47 -040077 $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
Mike Frysinger0858b832008-02-04 19:26:55 -050078 -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
Marian Balakowiczf9328632006-09-01 19:49:50 +020079 -L$(gcclibdir) -lgcc
Wolfgang Denk96582982006-10-24 13:55:18 +020080
81$(SREC):
Marian Balakowiczf9328632006-09-01 19:49:50 +020082$(obj)%.srec: $(obj)%
83 $(OBJCOPY) -O srec $< $@ 2>/dev/null
wdenk717b5aa2002-04-27 11:09:31 +000084
Wolfgang Denk96582982006-10-24 13:55:18 +020085$(BIN):
Marian Balakowiczf9328632006-09-01 19:49:50 +020086$(obj)%.bin: $(obj)%
87 $(OBJCOPY) -O binary $< $@ 2>/dev/null
wdenkdc7c9a12003-03-26 06:55:25 +000088
wdenk717b5aa2002-04-27 11:09:31 +000089#########################################################################
90
Marian Balakowiczf9328632006-09-01 19:49:50 +020091# defines $(obj).depend target
92include $(SRCTREE)/rules.mk
wdenk717b5aa2002-04-27 11:09:31 +000093
Marian Balakowiczf9328632006-09-01 19:49:50 +020094sinclude $(obj).depend
wdenk717b5aa2002-04-27 11:09:31 +000095
96#########################################################################