2002-04-27 20:09:31 +09:00
|
|
|
#
|
2006-09-02 02:49:50 +09:00
|
|
|
# (C) Copyright 2000-2006
|
2002-04-27 20:09:31 +09:00
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
#
|
2013-07-08 16:37:19 +09:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2002-04-27 20:09:31 +09:00
|
|
|
#
|
|
|
|
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
2009-09-05 08:54:45 +09:00
|
|
|
ELF-$(ARCH) :=
|
|
|
|
ELF-$(CPU) :=
|
|
|
|
ELF-y := hello_world
|
|
|
|
|
|
|
|
ELF-$(CONFIG_SMC91111) += smc91111_eeprom
|
|
|
|
ELF-$(CONFIG_SMC911X) += smc911x_eeprom
|
|
|
|
ELF-$(CONFIG_SPI_FLASH_ATMEL) += atmel_df_pow2
|
|
|
|
ELF-i386 += 82559_eeprom
|
|
|
|
ELF-mpc5xxx += interrupt
|
|
|
|
ELF-mpc8xx += test_burst timer
|
|
|
|
ELF-mpc8260 += mem_to_mem_idma2intr
|
|
|
|
ELF-ppc += sched
|
|
|
|
|
2009-11-10 02:13:00 +09:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2013-11-11 12:45:40 +09:00
|
|
|
ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(CPU)))
|
2009-11-10 02:13:00 +09:00
|
|
|
|
2011-02-22 06:07:00 +09:00
|
|
|
SREC := $(addsuffix .srec,$(ELF))
|
|
|
|
BIN := $(addsuffix .bin,$(ELF))
|
2009-09-05 08:54:45 +09:00
|
|
|
|
|
|
|
COBJS := $(ELF:=.o)
|
2002-04-27 20:09:31 +09:00
|
|
|
|
2010-11-05 23:48:07 +09:00
|
|
|
LIB = $(obj)libstubs.o
|
2009-09-05 08:54:45 +09:00
|
|
|
|
|
|
|
LIBAOBJS-$(ARCH) :=
|
|
|
|
LIBAOBJS-$(CPU) :=
|
|
|
|
LIBAOBJS-ppc += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
|
|
|
|
LIBAOBJS-mpc8xx += test_burst_lib.o
|
|
|
|
LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
|
|
|
|
|
|
|
|
LIBCOBJS = stubs.o
|
2006-09-02 02:49:50 +09:00
|
|
|
|
|
|
|
LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
|
|
|
|
|
2009-09-05 08:54:45 +09:00
|
|
|
SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
|
2006-09-02 02:49:50 +09:00
|
|
|
OBJS := $(addprefix $(obj),$(COBJS))
|
2006-10-24 20:55:18 +09:00
|
|
|
ELF := $(addprefix $(obj),$(ELF))
|
2006-09-02 02:49:50 +09:00
|
|
|
BIN := $(addprefix $(obj),$(BIN))
|
|
|
|
SREC := $(addprefix $(obj),$(SREC))
|
2002-04-27 20:09:31 +09:00
|
|
|
|
2013-09-10 22:51:44 +09:00
|
|
|
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
|
2003-08-30 05:57:53 +09:00
|
|
|
|
2010-06-16 04:48:25 +09:00
|
|
|
# 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
|
|
|
|
|
2010-09-13 07:38:49 +09:00
|
|
|
# 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.
|
2011-11-02 05:54:02 +09:00
|
|
|
CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
|
|
|
|
CFLAGS += $(CFLAGS_NTR)
|
2010-09-13 07:38:49 +09:00
|
|
|
|
2006-10-24 20:55:18 +09:00
|
|
|
all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
|
2002-04-27 20:09:31 +09:00
|
|
|
|
|
|
|
#########################################################################
|
2006-09-02 02:49:50 +09:00
|
|
|
$(LIB): $(obj).depend $(LIBOBJS)
|
2010-11-05 23:48:07 +09:00
|
|
|
$(call cmd_link_o_target, $(LIBOBJS))
|
2002-04-27 20:09:31 +09:00
|
|
|
|
2006-10-24 20:55:18 +09:00
|
|
|
$(ELF):
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)%: $(obj)%.o $(LIB)
|
2012-03-06 08:44:22 +09:00
|
|
|
$(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
|
2008-02-05 09:26:55 +09:00
|
|
|
-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
|
2013-09-10 22:51:44 +09:00
|
|
|
-L$(gcclibdir) -lgcc
|
2006-10-24 20:55:18 +09:00
|
|
|
|
|
|
|
$(SREC):
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)%.srec: $(obj)%
|
|
|
|
$(OBJCOPY) -O srec $< $@ 2>/dev/null
|
2002-04-27 20:09:31 +09:00
|
|
|
|
2006-10-24 20:55:18 +09:00
|
|
|
$(BIN):
|
2006-09-02 02:49:50 +09:00
|
|
|
$(obj)%.bin: $(obj)%
|
|
|
|
$(OBJCOPY) -O binary $< $@ 2>/dev/null
|
2003-03-26 15:55:25 +09:00
|
|
|
|
2002-04-27 20:09:31 +09:00
|
|
|
#########################################################################
|
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|
2002-04-27 20:09:31 +09:00
|
|
|
|
2006-09-02 02:49:50 +09:00
|
|
|
sinclude $(obj).depend
|
2002-04-27 20:09:31 +09:00
|
|
|
|
|
|
|
#########################################################################
|