colibri_imx6: fix video stdout in default environment
[oweals/u-boot.git] / examples / api / Makefile
1 # SPDX-License-Identifier: GPL-2.0+
2 #
3 # (C) Copyright 2007 Semihalf
4
5 # Provide symbol API_BUILD to signal that the API example is being built.
6 KBUILD_CPPFLAGS += -DAPI_BUILD
7
8 ifeq ($(ARCH),powerpc)
9 LOAD_ADDR = 0x40000
10 endif
11 ifeq ($(ARCH),arm)
12 LOAD_ADDR = 0x1000000
13 endif
14 ifeq ($(ARCH),mips)
15 ifdef CONFIG_64BIT
16 LOAD_ADDR = 0xffffffff80200000
17 else
18 LOAD_ADDR = 0x80200000
19 endif
20 endif
21
22 # Resulting ELF and binary exectuables will be named demo and demo.bin
23 extra-y = demo
24
25 # Source files located in the examples/api directory
26 OBJ-y += crt0.o
27 OBJ-y += demo.o
28 OBJ-y += glue.o
29 OBJ-y += libgenwrap.o
30
31 # Source files which exist outside the examples/api directory
32 EXT_COBJ-y += lib/crc32.o
33 EXT_COBJ-y += lib/ctype.o
34 EXT_COBJ-y += lib/div64.o
35 EXT_COBJ-y += lib/hexdump.o
36 EXT_COBJ-y += lib/string.o
37 EXT_COBJ-y += lib/time.o
38 EXT_COBJ-y += lib/vsprintf.o
39 EXT_COBJ-y += lib/charset.o
40 EXT_COBJ-$(CONFIG_LIB_UUID) += lib/uuid.o
41 EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
42 ifeq ($(ARCH),arm)
43 EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
44 endif
45
46 # Create a list of object files to be compiled
47 OBJS := $(OBJ-y) $(notdir $(EXT_COBJ-y) $(EXT_SOBJ-y))
48 targets += $(OBJS)
49 OBJS := $(addprefix $(obj)/,$(OBJS))
50
51 #########################################################################
52
53 quiet_cmd_link_demo = LD      $@
54 cmd_link_demo = $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $(filter-out $(PHONY), $^) $(PLATFORM_LIBS)
55
56 $(obj)/demo: $(OBJS) FORCE
57         $(call if_changed,link_demo)
58
59 # demo.bin is never genrated. Is this necessary?
60 OBJCOPYFLAGS_demo.bin := -O binary
61 $(obj)/demo.bin: $(obj)/demo FORCE
62         $(call if_changed,objcopy)
63
64 # Rule to build generic library C files
65 $(addprefix $(obj)/,$(notdir $(EXT_COBJ-y))): $(obj)/%.o: lib/%.c FORCE
66         $(call cmd,force_checksrc)
67         $(call if_changed_rule,cc_o_c)
68
69 # Rule to build architecture-specific library assembly files
70 $(addprefix $(obj)/,$(notdir $(EXT_SOBJ-y))): $(obj)/%.o: arch/$(ARCH)/lib/%.S FORCE
71         $(call if_changed_dep,as_o_S)