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
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
23 ELF-oxc += eepro100_eeprom
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.
30 ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)))
32 SREC := $(addsuffix .srec,$(ELF))
33 BIN := $(addsuffix .bin,$(ELF))
37 LIB = $(obj)libstubs.o
41 LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
42 LIBAOBJS-mpc8xx += test_burst_lib.o
43 LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
47 LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
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))
55 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
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
63 ifeq ($(ARCH),powerpc)
64 AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS))
65 CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS))
66 CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS))
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
72 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
73 CFLAGS += $(CFLAGS_NTR)
75 all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
77 #########################################################################
78 $(LIB): $(obj).depend $(LIBOBJS)
79 $(call cmd_link_o_target, $(LIBOBJS))
82 $(obj)%: $(obj)%.o $(LIB)
83 $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
84 -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
89 $(OBJCOPY) -O srec $< $@ 2>/dev/null
93 $(OBJCOPY) -O binary $< $@ 2>/dev/null
95 #########################################################################
97 # defines $(obj).depend target
98 include $(SRCTREE)/rules.mk
100 sinclude $(obj).depend
102 #########################################################################