]> git.ipfire.org Git - people/ms/u-boot.git/blame - examples/standalone/Makefile
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / examples / standalone / Makefile
CommitLineData
717b5aad 1#
f9328639 2# (C) Copyright 2000-2006
717b5aad
WD
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
1a459660 5# SPDX-License-Identifier: GPL-2.0+
717b5aad
WD
6#
7
717b5aad
WD
8include $(TOPDIR)/config.mk
9
557555fe
MF
10ELF-$(ARCH) :=
11ELF-$(BOARD) :=
12ELF-$(CPU) :=
13ELF-y := hello_world
14
15ELF-$(CONFIG_SMC91111) += smc91111_eeprom
16ELF-$(CONFIG_SMC911X) += smc911x_eeprom
17ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2
18ELF-i386 += 82559_eeprom
19ELF-mpc5xxx += interrupt
20ELF-mpc8xx += test_burst timer
21ELF-mpc8260 += mem_to_mem_idma2intr
22ELF-ppc += sched
23ELF-oxc += eepro100_eeprom
24
604f7ce5
SP
25#
26# Some versions of make do not handle trailing white spaces properly;
27# leading to build failures. The problem was found with GNU Make 3.80.
28# Using 'strip' as a workaround for the problem.
29#
30ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)))
31
0da43893
CC
32SREC := $(addsuffix .srec,$(ELF))
33BIN := $(addsuffix .bin,$(ELF))
557555fe
MF
34
35COBJS := $(ELF:=.o)
717b5aad 36
6d8962e8 37LIB = $(obj)libstubs.o
557555fe
MF
38
39LIBAOBJS-$(ARCH) :=
40LIBAOBJS-$(CPU) :=
41LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
42LIBAOBJS-mpc8xx += test_burst_lib.o
43LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
44
45LIBCOBJS = stubs.o
f9328639
MB
46
47LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
48
557555fe 49SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
f9328639 50OBJS := $(addprefix $(obj),$(COBJS))
96582987 51ELF := $(addprefix $(obj),$(ELF))
f9328639
MB
52BIN := $(addprefix $(obj),$(BIN))
53SREC := $(addprefix $(obj),$(SREC))
717b5aad 54
c29fdfc1
WD
55gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
56
717b5aad
WD
57CPPFLAGS += -I..
58
620bbba5
PT
59# For PowerPC there's no need to compile standalone applications as a
60# relocatable executable. The relocation data is not needed, and
61# also causes the entry point of the standalone application to be
62# inconsistent.
63ifeq ($(ARCH),powerpc)
64AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS))
65CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS))
66CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS))
67endif
68
c91d456c
PT
69# We don't want gcc reordering functions if possible. This ensures that an
70# application's entry point will be the first function in the application's
71# source file.
cca4e4ae
WD
72CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
73CFLAGS += $(CFLAGS_NTR)
c91d456c 74
96582987 75all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
717b5aad
WD
76
77#########################################################################
f9328639 78$(LIB): $(obj).depend $(LIBOBJS)
6d8962e8 79 $(call cmd_link_o_target, $(LIBOBJS))
717b5aad 80
96582987 81$(ELF):
f9328639 82$(obj)%: $(obj)%.o $(LIB)
e0e7f3b2 83 $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
0858b835 84 -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
f9328639 85 -L$(gcclibdir) -lgcc
96582987
WD
86
87$(SREC):
f9328639
MB
88$(obj)%.srec: $(obj)%
89 $(OBJCOPY) -O srec $< $@ 2>/dev/null
717b5aad 90
96582987 91$(BIN):
f9328639
MB
92$(obj)%.bin: $(obj)%
93 $(OBJCOPY) -O binary $< $@ 2>/dev/null
dc7c9a1a 94
717b5aad
WD
95#########################################################################
96
f9328639
MB
97# defines $(obj).depend target
98include $(SRCTREE)/rules.mk
717b5aad 99
f9328639 100sinclude $(obj).depend
717b5aad
WD
101
102#########################################################################