]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - examples/api/Makefile
Merge branch 'master' of git://git.denx.de/u-boot-spi
[karo-tx-uboot.git] / examples / api / Makefile
1 #
2 # (C) Copyright 2007 Semihalf
3 #
4 # SPDX-License-Identifier:      GPL-2.0+
5 #
6
7 ifeq ($(ARCH),powerpc)
8 LOAD_ADDR = 0x40000
9 endif
10 ifeq ($(ARCH),arm)
11 LOAD_ADDR = 0x1000000
12 endif
13
14 # Resulting ELF and binary exectuables will be named demo and demo.bin
15 extra-y = demo
16
17 # Source files located in the examples/api directory
18 SOBJ_FILES-y += crt0.o
19 COBJ_FILES-y += demo.o
20 COBJ_FILES-y += glue.o
21 COBJ_FILES-y += libgenwrap.o
22
23 # Source files which exist outside the examples/api directory
24 EXT_COBJ_FILES-y += lib/crc32.o
25 EXT_COBJ_FILES-y += lib/ctype.o
26 EXT_COBJ_FILES-y += lib/div64.o
27 EXT_COBJ_FILES-y += lib/string.o
28 EXT_COBJ_FILES-y += lib/time.o
29 EXT_COBJ_FILES-y += lib/vsprintf.o
30 EXT_SOBJ_FILES-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
31
32 # Create a list of object files to be compiled
33 OBJS    += $(addprefix $(obj)/,$(SOBJ_FILES-y))
34 OBJS    += $(addprefix $(obj)/,$(COBJ_FILES-y))
35 OBJS    += $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y)))
36 OBJS    += $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y)))
37
38 #########################################################################
39
40 $(obj)/demo:    $(OBJS)
41                 $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ $(PLATFORM_LIBS)
42
43 $(obj)/demo.bin: $(obj)/demo
44                 $(OBJCOPY) -O binary $< $@ 2>/dev/null
45
46 # Rule to build generic library C files
47 $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/lib/%.c FORCE
48         $(call cmd,force_checksrc)
49         $(call if_changed_rule,cc_o_c)
50
51 # Rule to build architecture-specific library assembly files
52 $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
53         $(call if_changed_dep,as_o_S)