]> git.ipfire.org Git - people/ms/u-boot.git/blame - examples/api/Makefile
core: add ofnode_get_by_phandle() api
[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
256060e4
HS
7# Provide symbol API_BUILD to signal that the API example is being built.
8KBUILD_CPPFLAGS += -DAPI_BUILD
9
a47a12be 10ifeq ($(ARCH),powerpc)
500856eb
RJ
11LOAD_ADDR = 0x40000
12endif
7fb6c4f9
RJ
13ifeq ($(ARCH),arm)
14LOAD_ADDR = 0x1000000
15endif
7c604231 16ifeq ($(ARCH),mips)
78757d52
SG
17ifdef CONFIG_64BIT
18LOAD_ADDR = 0xffffffff80200000
19else
7c604231
SG
20LOAD_ADDR = 0x80200000
21endif
78757d52 22endif
500856eb 23
117d0ab5 24# Resulting ELF and binary exectuables will be named demo and demo.bin
4a20df39 25extra-y = demo
876b3cef 26
d4abc757 27# Source files located in the examples/api directory
04a34c96
MY
28OBJ-y += crt0.o
29OBJ-y += demo.o
30OBJ-y += glue.o
31OBJ-y += libgenwrap.o
876b3cef 32
d4abc757 33# Source files which exist outside the examples/api directory
04a34c96
MY
34EXT_COBJ-y += lib/crc32.o
35EXT_COBJ-y += lib/ctype.o
36EXT_COBJ-y += lib/div64.o
37EXT_COBJ-y += lib/string.o
38EXT_COBJ-y += lib/time.o
39EXT_COBJ-y += lib/vsprintf.o
274325c5 40EXT_COBJ-y += lib/charset.o
22ada0c8 41EXT_COBJ-$(CONFIG_LIB_UUID) += lib/uuid.o
04a34c96 42EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
40d5534c
TR
43ifeq ($(ARCH),arm)
44EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
45endif
117d0ab5 46
876b3cef 47# Create a list of object files to be compiled
04a34c96
MY
48OBJS := $(OBJ-y) $(notdir $(EXT_COBJ-y) $(EXT_SOBJ-y))
49targets += $(OBJS)
50OBJS := $(addprefix $(obj)/,$(OBJS))
500856eb 51
500856eb 52#########################################################################
522f6f02 53
04a34c96
MY
54quiet_cmd_link_demo = LD $@
55cmd_link_demo = $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $(filter-out $(PHONY), $^) $(PLATFORM_LIBS)
56
57$(obj)/demo: $(OBJS) FORCE
58 $(call if_changed,link_demo)
4a20df39 59
f9c235fd
MY
60# demo.bin is never genrated. Is this necessary?
61OBJCOPYFLAGS_demo.bin := -O binary
62$(obj)/demo.bin: $(obj)/demo FORCE
63 $(call if_changed,objcopy)
500856eb 64
876b3cef 65# Rule to build generic library C files
04a34c96 66$(addprefix $(obj)/,$(notdir $(EXT_COBJ-y))): $(obj)/%.o: lib/%.c FORCE
6825a95b
MY
67 $(call cmd,force_checksrc)
68 $(call if_changed_rule,cc_o_c)
500856eb 69
876b3cef 70# Rule to build architecture-specific library assembly files
40d5534c 71$(addprefix $(obj)/,$(notdir $(EXT_SOBJ-y))): $(obj)/%.o: arch/$(ARCH)/lib/%.S FORCE
6825a95b 72 $(call if_changed_dep,as_o_S)