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