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