]>
Commit | Line | Data |
---|---|---|
717b5aad | 1 | # |
f9328639 | 2 | # (C) Copyright 2000-2006 |
717b5aad WD |
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 | ||
717b5aad WD |
24 | include $(TOPDIR)/config.mk |
25 | ||
557555fe MF |
26 | ELF-$(ARCH) := |
27 | ELF-$(BOARD) := | |
28 | ELF-$(CPU) := | |
29 | ELF-y := hello_world | |
30 | ||
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 | |
40 | ||
604f7ce5 SP |
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 | ||
557555fe MF |
48 | SREC = $(addsuffix .srec,$(ELF)) |
49 | BIN = $(addsuffix .bin,$(ELF)) | |
50 | ||
51 | COBJS := $(ELF:=.o) | |
717b5aad | 52 | |
f9328639 | 53 | LIB = $(obj)libstubs.a |
557555fe MF |
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 | |
f9328639 MB |
62 | |
63 | LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS)) | |
64 | ||
557555fe | 65 | SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) |
f9328639 | 66 | OBJS := $(addprefix $(obj),$(COBJS)) |
96582987 | 67 | ELF := $(addprefix $(obj),$(ELF)) |
f9328639 MB |
68 | BIN := $(addprefix $(obj),$(BIN)) |
69 | SREC := $(addprefix $(obj),$(SREC)) | |
717b5aad | 70 | |
c29fdfc1 WD |
71 | gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) |
72 | ||
717b5aad WD |
73 | CPPFLAGS += -I.. |
74 | ||
620bbba5 PT |
75 | # For PowerPC there's no need to compile standalone applications as a |
76 | # relocatable executable. The relocation data is not needed, and | |
77 | # also causes the entry point of the standalone application to be | |
78 | # inconsistent. | |
79 | ifeq ($(ARCH),powerpc) | |
80 | AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS)) | |
81 | CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS)) | |
82 | CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS)) | |
83 | endif | |
84 | ||
c91d456c PT |
85 | # We don't want gcc reordering functions if possible. This ensures that an |
86 | # application's entry point will be the first function in the application's | |
87 | # source file. | |
88 | CFLAGS += $(call cc-option,-fno-toplevel-reorder) | |
89 | ||
96582987 | 90 | all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) |
717b5aad WD |
91 | |
92 | ######################################################################### | |
f9328639 | 93 | $(LIB): $(obj).depend $(LIBOBJS) |
2b208f53 | 94 | $(AR) $(ARFLAGS) $@ $(LIBOBJS) |
717b5aad | 95 | |
96582987 | 96 | $(ELF): |
f9328639 | 97 | $(obj)%: $(obj)%.o $(LIB) |
262ae0a6 | 98 | $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \ |
0858b835 | 99 | -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ |
f9328639 | 100 | -L$(gcclibdir) -lgcc |
96582987 WD |
101 | |
102 | $(SREC): | |
f9328639 MB |
103 | $(obj)%.srec: $(obj)% |
104 | $(OBJCOPY) -O srec $< $@ 2>/dev/null | |
717b5aad | 105 | |
96582987 | 106 | $(BIN): |
f9328639 MB |
107 | $(obj)%.bin: $(obj)% |
108 | $(OBJCOPY) -O binary $< $@ 2>/dev/null | |
dc7c9a1a | 109 | |
717b5aad WD |
110 | ######################################################################### |
111 | ||
f9328639 MB |
112 | # defines $(obj).depend target |
113 | include $(SRCTREE)/rules.mk | |
717b5aad | 114 | |
f9328639 | 115 | sinclude $(obj).depend |
717b5aad WD |
116 | |
117 | ######################################################################### |