2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 # SPDX-License-Identifier: GPL-2.0+
8 include $(TOPDIR)/config.mk
14 ELF-$(CONFIG_SMC91111) += smc91111_eeprom
15 ELF-$(CONFIG_SMC911X) += smc911x_eeprom
16 ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2
17 ELF-i386 += 82559_eeprom
18 ELF-mpc5xxx += interrupt
19 ELF-mpc8xx += test_burst timer
20 ELF-mpc8260 += mem_to_mem_idma2intr
24 # Some versions of make do not handle trailing white spaces properly;
25 # leading to build failures. The problem was found with GNU Make 3.80.
26 # Using 'strip' as a workaround for the problem.
28 ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(CPU)))
30 SREC := $(addsuffix .srec,$(ELF))
31 BIN := $(addsuffix .bin,$(ELF))
35 LIB = $(obj)libstubs.o
39 LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
40 LIBAOBJS-mpc8xx += test_burst_lib.o
41 LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
45 LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
47 SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
48 OBJS := $(addprefix $(obj),$(COBJS))
49 ELF := $(addprefix $(obj),$(ELF))
50 BIN := $(addprefix $(obj),$(BIN))
51 SREC := $(addprefix $(obj),$(SREC))
53 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
57 # For PowerPC there's no need to compile standalone applications as a
58 # relocatable executable. The relocation data is not needed, and
59 # also causes the entry point of the standalone application to be
61 ifeq ($(ARCH),powerpc)
62 AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS))
63 CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS))
64 CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS))
67 # We don't want gcc reordering functions if possible. This ensures that an
68 # application's entry point will be the first function in the application's
70 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
71 CFLAGS += $(CFLAGS_NTR)
73 all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
75 #########################################################################
76 $(LIB): $(obj).depend $(LIBOBJS)
77 $(call cmd_link_o_target, $(LIBOBJS))
80 $(obj)%: $(obj)%.o $(LIB)
81 $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
82 -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
87 $(OBJCOPY) -O srec $< $@ 2>/dev/null
91 $(OBJCOPY) -O binary $< $@ 2>/dev/null
93 #########################################################################
95 # defines $(obj).depend target
96 include $(SRCTREE)/rules.mk
98 sinclude $(obj).depend
100 #########################################################################