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 8include $(TOPDIR)/config.mk 9 10ELF-$(ARCH) := 11ELF-$(CPU) := 12ELF-y := hello_world 13 14ELF-$(CONFIG_SMC91111) += smc91111_eeprom 15ELF-$(CONFIG_SMC911X) += smc911x_eeprom 16ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2 17ELF-i386 += 82559_eeprom 18ELF-mpc5xxx += interrupt 19ELF-mpc8xx += test_burst timer 20ELF-mpc8260 += mem_to_mem_idma2intr 21ELF-ppc += sched 22 23# 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. 27# 28ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(CPU))) 29 30SREC := $(addsuffix .srec,$(ELF)) 31BIN := $(addsuffix .bin,$(ELF)) 32 33COBJS := $(ELF:=.o) 34 35LIB = $(obj)libstubs.o 36 37LIBAOBJS-$(ARCH) := 38LIBAOBJS-$(CPU) := 39LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o 40LIBAOBJS-mpc8xx += test_burst_lib.o 41LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU)) 42 43LIBCOBJS = stubs.o 44 45LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS)) 46 47SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) 48OBJS := $(addprefix $(obj),$(COBJS)) 49ELF := $(addprefix $(obj),$(ELF)) 50BIN := $(addprefix $(obj),$(BIN)) 51SREC := $(addprefix $(obj),$(SREC)) 52 53gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) 54 55CPPFLAGS += -I.. 56 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 60# inconsistent. 61ifeq ($(ARCH),powerpc) 62AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS)) 63CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS)) 64CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS)) 65endif 66 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 69# source file. 70CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder) 71CFLAGS += $(CFLAGS_NTR) 72 73all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF) 74 75######################################################################### 76$(LIB): $(obj).depend $(LIBOBJS) 77 $(call cmd_link_o_target, $(LIBOBJS)) 78 79$(ELF): 80$(obj)%: $(obj)%.o $(LIB) 81 $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \ 82 -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ 83 -L$(gcclibdir) -lgcc 84 85$(SREC): 86$(obj)%.srec: $(obj)% 87 $(OBJCOPY) -O srec $< $@ 2>/dev/null 88 89$(BIN): 90$(obj)%.bin: $(obj)% 91 $(OBJCOPY) -O binary $< $@ 2>/dev/null 92 93######################################################################### 94 95# defines $(obj).depend target 96include $(SRCTREE)/rules.mk 97 98sinclude $(obj).depend 99 100######################################################################### 101