]> git.ipfire.org Git - people/ms/u-boot.git/blob - examples/standalone/Makefile
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / examples / standalone / Makefile
1 #
2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 #
5 # SPDX-License-Identifier: GPL-2.0+
6 #
7
8 include $(TOPDIR)/config.mk
9
10 ELF-$(ARCH) :=
11 ELF-$(BOARD) :=
12 ELF-$(CPU) :=
13 ELF-y := hello_world
14
15 ELF-$(CONFIG_SMC91111) += smc91111_eeprom
16 ELF-$(CONFIG_SMC911X) += smc911x_eeprom
17 ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2
18 ELF-i386 += 82559_eeprom
19 ELF-mpc5xxx += interrupt
20 ELF-mpc8xx += test_burst timer
21 ELF-mpc8260 += mem_to_mem_idma2intr
22 ELF-ppc += sched
23 ELF-oxc += eepro100_eeprom
24
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 #
30 ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)))
31
32 SREC := $(addsuffix .srec,$(ELF))
33 BIN := $(addsuffix .bin,$(ELF))
34
35 COBJS := $(ELF:=.o)
36
37 LIB = $(obj)libstubs.o
38
39 LIBAOBJS-$(ARCH) :=
40 LIBAOBJS-$(CPU) :=
41 LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
42 LIBAOBJS-mpc8xx += test_burst_lib.o
43 LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
44
45 LIBCOBJS = stubs.o
46
47 LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
48
49 SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
50 OBJS := $(addprefix $(obj),$(COBJS))
51 ELF := $(addprefix $(obj),$(ELF))
52 BIN := $(addprefix $(obj),$(BIN))
53 SREC := $(addprefix $(obj),$(SREC))
54
55 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
56
57 CPPFLAGS += -I..
58
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.
63 ifeq ($(ARCH),powerpc)
64 AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS))
65 CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS))
66 CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS))
67 endif
68
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.
72 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
73 CFLAGS += $(CFLAGS_NTR)
74
75 all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
76
77 #########################################################################
78 $(LIB): $(obj).depend $(LIBOBJS)
79 $(call cmd_link_o_target, $(LIBOBJS))
80
81 $(ELF):
82 $(obj)%: $(obj)%.o $(LIB)
83 $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_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
98 include $(SRCTREE)/rules.mk
99
100 sinclude $(obj).depend
101
102 #########################################################################