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