X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=examples%2Fstandalone%2FMakefile;h=baaa2fbe4def0c7c9707603293a75287daf6d182;hb=951c6baaf44c7fd4335b75fb92840d4e42c94927;hp=5e2f2bcaeb45628ef88100faa1d8b351243f3620;hpb=557555fe0b82940ba7cc69f81d31d6ef4d4933b4;p=u-boot diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5e2f2bcaeb..baaa2fbe4d 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -38,13 +38,19 @@ ELF-mpc8260 += mem_to_mem_idma2intr ELF-ppc += sched ELF-oxc += eepro100_eeprom -ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) -SREC = $(addsuffix .srec,$(ELF)) -BIN = $(addsuffix .bin,$(ELF)) +# +# Some versions of make do not handle trailing white spaces properly; +# leading to build failures. The problem was found with GNU Make 3.80. +# Using 'strip' as a workaround for the problem. +# +ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))) + +SREC := $(addsuffix .srec,$(ELF)) +BIN := $(addsuffix .bin,$(ELF)) COBJS := $(ELF:=.o) -LIB = $(obj)libstubs.a +LIB = $(obj)libstubs.o LIBAOBJS-$(ARCH) := LIBAOBJS-$(CPU) := @@ -66,15 +72,31 @@ gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) CPPFLAGS += -I.. +# For PowerPC there's no need to compile standalone applications as a +# relocatable executable. The relocation data is not needed, and +# also causes the entry point of the standalone application to be +# inconsistent. +ifeq ($(ARCH),powerpc) +AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS)) +CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS)) +CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS)) +endif + +# We don't want gcc reordering functions if possible. This ensures that an +# application's entry point will be the first function in the application's +# source file. +CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder) +CFLAGS += $(CFLAGS_NTR) + all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) ######################################################################### $(LIB): $(obj).depend $(LIBOBJS) - $(AR) $(ARFLAGS) $@ $(LIBOBJS) + $(call cmd_link_o_target, $(LIBOBJS)) $(ELF): $(obj)%: $(obj)%.o $(LIB) - $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \ + $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \ -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ -L$(gcclibdir) -lgcc