xref: /openbmc/u-boot/examples/standalone/Makefile (revision a3f3897b)
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
24include $(TOPDIR)/config.mk
25
26ELF-$(ARCH)  :=
27ELF-$(BOARD) :=
28ELF-$(CPU)   :=
29ELF-y        := hello_world
30
31ELF-$(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
40
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#
46ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)))
47
48SREC = $(addsuffix .srec,$(ELF))
49BIN  = $(addsuffix .bin,$(ELF))
50
51COBJS	:= $(ELF:=.o)
52
53LIB	= $(obj)libstubs.a
54
55LIBAOBJS-$(ARCH)     :=
56LIBAOBJS-$(CPU)      :=
57LIBAOBJS-ppc         += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
58LIBAOBJS-mpc8xx      += test_burst_lib.o
59LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
60
61LIBCOBJS = stubs.o
62
63LIBOBJS	= $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
64
65SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
66OBJS	:= $(addprefix $(obj),$(COBJS))
67ELF	:= $(addprefix $(obj),$(ELF))
68BIN	:= $(addprefix $(obj),$(BIN))
69SREC	:= $(addprefix $(obj),$(SREC))
70
71gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
72
73CPPFLAGS += -I..
74
75all:	$(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
76
77#########################################################################
78$(LIB):	$(obj).depend $(LIBOBJS)
79		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
80
81$(ELF):
82$(obj)%:	$(obj)%.o $(LIB)
83		$(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
84			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
85			-L$(gcclibdir) -lgcc
86
87$(SREC):
88$(obj)%.srec:	$(obj)%
89		$(OBJCOPY) -O srec $< $@ 2>/dev/null
90
91$(BIN):
92$(obj)%.bin:	$(obj)%
93		$(OBJCOPY) -O binary $< $@ 2>/dev/null
94
95#########################################################################
96
97# defines $(obj).depend target
98include $(SRCTREE)/rules.mk
99
100sinclude $(obj).depend
101
102#########################################################################
103