]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - examples/standalone/Makefile
examples: x86: delete 82559_eeprom
[karo-tx-uboot.git] / examples / standalone / Makefile
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
8 include $(TOPDIR)/config.mk
9
10 ELF-y        := hello_world
11
12 ELF-$(CONFIG_SMC91111)           += smc91111_eeprom
13 ELF-$(CONFIG_SMC911X)            += smc911x_eeprom
14 ELF-$(CONFIG_SPI_FLASH_ATMEL)    += atmel_df_pow2
15 ELF-$(CONFIG_MPC5xxx)            += interrupt
16 ELF-$(CONFIG_8xx)                += test_burst timer
17 ELF-$(CONFIG_8260)               += mem_to_mem_idma2intr
18 ELF-$(CONFIG_PPC)                += sched
19
20 #
21 # Some versions of make do not handle trailing white spaces properly;
22 # leading to build failures. The problem was found with GNU Make 3.80.
23 # Using 'strip' as a workaround for the problem.
24 #
25 ELF := $(strip $(ELF-y))
26
27 SREC := $(addsuffix .srec,$(ELF))
28 BIN  := $(addsuffix .bin,$(ELF))
29
30 COBJS   := $(ELF:=.o)
31
32 LIB     = $(obj)libstubs.o
33
34 LIBAOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o
35 LIBAOBJS-$(CONFIG_8xx) += test_burst_lib.o
36 LIBAOBJS := $(LIBAOBJS-y)
37
38 LIBCOBJS = stubs.o
39
40 LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
41
42 SRCS    := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
43 OBJS    := $(addprefix $(obj),$(COBJS))
44 ELF     := $(addprefix $(obj),$(ELF))
45 BIN     := $(addprefix $(obj),$(BIN))
46 SREC    := $(addprefix $(obj),$(SREC))
47
48 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
49
50 # For PowerPC there's no need to compile standalone applications as a
51 # relocatable executable.  The relocation data is not needed, and
52 # also causes the entry point of the standalone application to be
53 # inconsistent.
54 ifeq ($(ARCH),powerpc)
55 AFLAGS := $(filter-out $(RELFLAGS),$(AFLAGS))
56 CFLAGS := $(filter-out $(RELFLAGS),$(CFLAGS))
57 CPPFLAGS := $(filter-out $(RELFLAGS),$(CPPFLAGS))
58 endif
59
60 # We don't want gcc reordering functions if possible.  This ensures that an
61 # application's entry point will be the first function in the application's
62 # source file.
63 CFLAGS_NTR := $(call cc-option,-fno-toplevel-reorder)
64 CFLAGS += $(CFLAGS_NTR)
65
66 all:    $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
67
68 #########################################################################
69 $(LIB): $(obj).depend $(LIBOBJS)
70         $(call cmd_link_o_target, $(LIBOBJS))
71
72 $(ELF):
73 $(obj)%:        $(obj)%.o $(LIB)
74                 $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
75                         -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
76                         -L$(gcclibdir) -lgcc
77
78 $(SREC):
79 $(obj)%.srec:   $(obj)%
80                 $(OBJCOPY) -O srec $< $@ 2>/dev/null
81
82 $(BIN):
83 $(obj)%.bin:    $(obj)%
84                 $(OBJCOPY) -O binary $< $@ 2>/dev/null
85
86 #########################################################################
87
88 # defines $(obj).depend target
89 include $(SRCTREE)/rules.mk
90
91 sinclude $(obj).depend
92
93 #########################################################################