]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | # SPDX-License-Identifier: GPL-2.0+ |
717b5aad | 2 | # |
f9328639 | 3 | # (C) Copyright 2000-2006 |
717b5aad | 4 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
717b5aad | 5 | |
4a20df39 | 6 | extra-y := hello_world |
4a20df39 | 7 | extra-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2 |
4a20df39 | 8 | extra-$(CONFIG_PPC) += sched |
557555fe | 9 | |
604f7ce5 SP |
10 | # |
11 | # Some versions of make do not handle trailing white spaces properly; | |
12 | # leading to build failures. The problem was found with GNU Make 3.80. | |
13 | # Using 'strip' as a workaround for the problem. | |
14 | # | |
4a20df39 MY |
15 | ELF := $(strip $(extra-y)) |
16 | ||
17 | extra-y += $(addsuffix .srec,$(extra-y)) $(addsuffix .bin,$(extra-y)) | |
8e714432 | 18 | clean-files := *.srec *.bin |
604f7ce5 | 19 | |
557555fe | 20 | COBJS := $(ELF:=.o) |
717b5aad | 21 | |
9e414032 | 22 | LIB = $(obj)/libstubs.o |
557555fe | 23 | |
04a34c96 | 24 | LIBOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o |
04a34c96 | 25 | LIBOBJS-y += stubs.o |
f9328639 | 26 | |
04a34c96 | 27 | targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y) |
f9328639 | 28 | |
04a34c96 | 29 | LIBOBJS := $(addprefix $(obj)/,$(LIBOBJS-y)) |
9e414032 | 30 | ELF := $(addprefix $(obj)/,$(ELF)) |
717b5aad | 31 | |
332f4802 TR |
32 | # Disable LTO for these builds |
33 | CFLAGS_REMOVE_hello_world.o := $(LTO_CFLAGS) | |
34 | CFLAGS_REMOVE_stubs.o := $(LTO_CFLAGS) | |
35 | ||
620bbba5 PT |
36 | # For PowerPC there's no need to compile standalone applications as a |
37 | # relocatable executable. The relocation data is not needed, and | |
38 | # also causes the entry point of the standalone application to be | |
39 | # inconsistent. | |
026f9cf2 MY |
40 | ifeq ($(CONFIG_PPC),y) |
41 | PLATFORM_CPPFLAGS := $(filter-out $(RELFLAGS),$(PLATFORM_CPPFLAGS)) | |
620bbba5 PT |
42 | endif |
43 | ||
c91d456c PT |
44 | # We don't want gcc reordering functions if possible. This ensures that an |
45 | # application's entry point will be the first function in the application's | |
46 | # source file. | |
6825a95b | 47 | ccflags-y += $(call cc-option,-fno-toplevel-reorder) |
717b5aad | 48 | |
1d3b97c9 DS |
49 | LDFLAGS_STANDALONE += -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) |
50 | ||
717b5aad | 51 | ######################################################################### |
6825a95b MY |
52 | |
53 | quiet_cmd_link_lib = LD $@ | |
54 | cmd_link_lib = $(LD) $(ld_flags) -r -o $@ $(filter $(LIBOBJS), $^) | |
55 | ||
56 | $(LIB): $(LIBOBJS) FORCE | |
57 | $(call if_changed,link_lib) | |
717b5aad | 58 | |
04a34c96 | 59 | quiet_cmd_link_elf = LD $@ |
587e4a42 | 60 | cmd_link_elf = $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_STANDALONE) -g \ |
e75e73dd | 61 | -o $@ -e $(SYM_PREFIX)$(@F) $< $(LIB) $(PLATFORM_LIBGCC) |
04a34c96 MY |
62 | |
63 | $(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE | |
64 | $(call if_changed,link_elf) | |
96582987 | 65 | |
d3a9ba7f | 66 | $(obj)/%.srec: OBJCOPYFLAGS += -O srec |
f9c235fd MY |
67 | $(obj)/%.srec: $(obj)/% FORCE |
68 | $(call if_changed,objcopy) | |
717b5aad | 69 | |
d3a9ba7f | 70 | $(obj)/%.bin: OBJCOPYFLAGS += -O binary |
f9c235fd MY |
71 | $(obj)/%.bin: $(obj)/% FORCE |
72 | $(call if_changed,objcopy) | |
62e92077 AA |
73 | |
74 | # some files can only build in ARM or THUMB2, not THUMB1 | |
75 | ||
76 | ifdef CONFIG_SYS_THUMB_BUILD | |
77 | ifndef CONFIG_HAS_THUMB2 | |
78 | ||
79 | CFLAGS_stubs.o := -marm | |
80 | ||
81 | endif | |
82 | endif |