wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 1 | # |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 2 | # (C) Copyright 2000-2006 |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 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 | |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 24 | include $(TOPDIR)/config.mk |
| 25 | |
Mike Frysinger | 557555f | 2009-09-04 19:54:45 -0400 | [diff] [blame] | 26 | ELF-$(ARCH) := |
| 27 | ELF-$(BOARD) := |
| 28 | ELF-$(CPU) := |
| 29 | ELF-y := hello_world |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 30 | |
Mike Frysinger | 557555f | 2009-09-04 19:54:45 -0400 | [diff] [blame] | 31 | ELF-$(CONFIG_SMC91111) += smc91111_eeprom |
| 32 | ELF-$(CONFIG_SMC911X) += smc911x_eeprom |
| 33 | ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2 |
| 34 | ELF-i386 += 82559_eeprom |
| 35 | ELF-mpc5xxx += interrupt |
| 36 | ELF-mpc8xx += test_burst timer |
| 37 | ELF-mpc8260 += mem_to_mem_idma2intr |
| 38 | ELF-ppc += sched |
| 39 | ELF-oxc += eepro100_eeprom |
Mike Frysinger | 65f6f07 | 2009-07-23 16:37:03 -0400 | [diff] [blame] | 40 | |
Sanjeev Premi | 604f7ce | 2009-11-09 22:43:00 +0530 | [diff] [blame^] | 41 | # |
| 42 | # Some versions of make do not handle trailing white spaces properly; |
| 43 | # leading to build failures. The problem was found with GNU Make 3.80. |
| 44 | # Using 'strip' as a workaround for the problem. |
| 45 | # |
| 46 | ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))) |
| 47 | |
Mike Frysinger | 557555f | 2009-09-04 19:54:45 -0400 | [diff] [blame] | 48 | SREC = $(addsuffix .srec,$(ELF)) |
| 49 | BIN = $(addsuffix .bin,$(ELF)) |
wdenk | 931da93 | 2005-05-07 19:06:32 +0000 | [diff] [blame] | 50 | |
Mike Frysinger | 557555f | 2009-09-04 19:54:45 -0400 | [diff] [blame] | 51 | COBJS := $(ELF:=.o) |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 52 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 53 | LIB = $(obj)libstubs.a |
Mike Frysinger | 557555f | 2009-09-04 19:54:45 -0400 | [diff] [blame] | 54 | |
| 55 | LIBAOBJS-$(ARCH) := |
| 56 | LIBAOBJS-$(CPU) := |
| 57 | LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o |
| 58 | LIBAOBJS-mpc8xx += test_burst_lib.o |
| 59 | LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU)) |
| 60 | |
| 61 | LIBCOBJS = stubs.o |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 62 | |
| 63 | LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS)) |
| 64 | |
Mike Frysinger | 557555f | 2009-09-04 19:54:45 -0400 | [diff] [blame] | 65 | SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 66 | OBJS := $(addprefix $(obj),$(COBJS)) |
Wolfgang Denk | 9658298 | 2006-10-24 13:55:18 +0200 | [diff] [blame] | 67 | ELF := $(addprefix $(obj),$(ELF)) |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 68 | BIN := $(addprefix $(obj),$(BIN)) |
| 69 | SREC := $(addprefix $(obj),$(SREC)) |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 70 | |
wdenk | c29fdfc | 2003-08-29 20:57:53 +0000 | [diff] [blame] | 71 | gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) |
| 72 | |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 73 | CPPFLAGS += -I.. |
| 74 | |
Wolfgang Denk | 9658298 | 2006-10-24 13:55:18 +0200 | [diff] [blame] | 75 | all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 76 | |
| 77 | ######################################################################### |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 78 | $(LIB): $(obj).depend $(LIBOBJS) |
Wolfgang Denk | 2b208f5 | 2006-10-09 01:02:05 +0200 | [diff] [blame] | 79 | $(AR) $(ARFLAGS) $@ $(LIBOBJS) |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 80 | |
Wolfgang Denk | 9658298 | 2006-10-24 13:55:18 +0200 | [diff] [blame] | 81 | $(ELF): |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 82 | $(obj)%: $(obj)%.o $(LIB) |
Mike Frysinger | 262ae0a | 2009-09-03 23:12:47 -0400 | [diff] [blame] | 83 | $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \ |
Mike Frysinger | 0858b83 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 84 | -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 85 | -L$(gcclibdir) -lgcc |
Wolfgang Denk | 9658298 | 2006-10-24 13:55:18 +0200 | [diff] [blame] | 86 | |
| 87 | $(SREC): |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 88 | $(obj)%.srec: $(obj)% |
| 89 | $(OBJCOPY) -O srec $< $@ 2>/dev/null |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 90 | |
Wolfgang Denk | 9658298 | 2006-10-24 13:55:18 +0200 | [diff] [blame] | 91 | $(BIN): |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 92 | $(obj)%.bin: $(obj)% |
| 93 | $(OBJCOPY) -O binary $< $@ 2>/dev/null |
wdenk | dc7c9a1 | 2003-03-26 06:55:25 +0000 | [diff] [blame] | 94 | |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 95 | ######################################################################### |
| 96 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 97 | # defines $(obj).depend target |
| 98 | include $(SRCTREE)/rules.mk |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 99 | |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 100 | sinclude $(obj).depend |
wdenk | 717b5aa | 2002-04-27 11:09:31 +0000 | [diff] [blame] | 101 | |
| 102 | ######################################################################### |