2 # (C) Copyright 2007 Semihalf
4 # SPDX-License-Identifier: GPL-2.0+
15 LOAD_ADDR = 0xffffffff80200000
17 LOAD_ADDR = 0x80200000
21 # Resulting ELF and binary exectuables will be named demo and demo.bin
24 # Source files located in the examples/api directory
30 # Source files which exist outside the examples/api directory
31 EXT_COBJ-y += lib/crc32.o
32 EXT_COBJ-y += lib/ctype.o
33 EXT_COBJ-y += lib/div64.o
34 EXT_COBJ-y += lib/string.o
35 EXT_COBJ-y += lib/time.o
36 EXT_COBJ-y += lib/vsprintf.o
37 EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
39 # Create a list of object files to be compiled
40 OBJS := $(OBJ-y) $(notdir $(EXT_COBJ-y) $(EXT_SOBJ-y))
42 OBJS := $(addprefix $(obj)/,$(OBJS))
44 #########################################################################
46 quiet_cmd_link_demo = LD $@
47 cmd_link_demo = $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $(filter-out $(PHONY), $^) $(PLATFORM_LIBS)
49 $(obj)/demo: $(OBJS) FORCE
50 $(call if_changed,link_demo)
52 # demo.bin is never genrated. Is this necessary?
53 OBJCOPYFLAGS_demo.bin := -O binary
54 $(obj)/demo.bin: $(obj)/demo FORCE
55 $(call if_changed,objcopy)
57 # Rule to build generic library C files
58 $(addprefix $(obj)/,$(notdir $(EXT_COBJ-y))): $(obj)/%.o: lib/%.c FORCE
59 $(call cmd,force_checksrc)
60 $(call if_changed_rule,cc_o_c)
62 # Rule to build architecture-specific library assembly files
63 $(addprefix $(obj)/,$(notdir $(EXT_SOBJ-y))): $(obj)/%.o: arch/powerpc/lib/%.S FORCE
64 $(call if_changed_dep,as_o_S)