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