]>
Commit | Line | Data |
---|---|---|
500856eb RJ |
1 | # |
2 | # (C) Copyright 2007 Semihalf | |
3 | # | |
1a459660 | 4 | # SPDX-License-Identifier: GPL-2.0+ |
500856eb RJ |
5 | # |
6 | ||
d9580025 | 7 | ifdef FTRACE |
6825a95b | 8 | ccflags-y += -finstrument-functions -DFTRACE |
d9580025 MY |
9 | endif |
10 | ||
a47a12be | 11 | ifeq ($(ARCH),powerpc) |
500856eb RJ |
12 | LOAD_ADDR = 0x40000 |
13 | endif | |
7fb6c4f9 RJ |
14 | ifeq ($(ARCH),arm) |
15 | LOAD_ADDR = 0x1000000 | |
16 | endif | |
500856eb | 17 | |
117d0ab5 | 18 | # Resulting ELF and binary exectuables will be named demo and demo.bin |
4a20df39 | 19 | extra-y = demo |
876b3cef | 20 | |
d4abc757 | 21 | # Source files located in the examples/api directory |
8a7e7d56 MY |
22 | SOBJ_FILES-y += crt0.o |
23 | COBJ_FILES-y += demo.o | |
24 | COBJ_FILES-y += glue.o | |
25 | COBJ_FILES-y += libgenwrap.o | |
876b3cef | 26 | |
d4abc757 | 27 | # Source files which exist outside the examples/api directory |
8a7e7d56 MY |
28 | EXT_COBJ_FILES-y += lib/crc32.o |
29 | EXT_COBJ_FILES-y += lib/ctype.o | |
30 | EXT_COBJ_FILES-y += lib/div64.o | |
31 | EXT_COBJ_FILES-y += lib/string.o | |
32 | EXT_COBJ_FILES-y += lib/time.o | |
33 | EXT_COBJ_FILES-y += lib/vsprintf.o | |
34 | EXT_SOBJ_FILES-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o | |
117d0ab5 | 35 | |
876b3cef | 36 | # Create a list of object files to be compiled |
9e414032 MY |
37 | OBJS += $(addprefix $(obj)/,$(SOBJ_FILES-y)) |
38 | OBJS += $(addprefix $(obj)/,$(COBJ_FILES-y)) | |
39 | OBJS += $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))) | |
40 | OBJS += $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))) | |
500856eb | 41 | |
500856eb | 42 | ######################################################################### |
522f6f02 | 43 | |
9e414032 | 44 | $(obj)/demo: $(OBJS) |
e32a268b | 45 | $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ $(PLATFORM_LIBS) |
4a20df39 | 46 | |
9e414032 | 47 | $(obj)/demo.bin: $(obj)/demo |
4a20df39 | 48 | $(OBJCOPY) -O binary $< $@ 2>/dev/null |
500856eb | 49 | |
876b3cef | 50 | # Rule to build generic library C files |
6825a95b MY |
51 | $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/lib/%.c FORCE |
52 | $(call cmd,force_checksrc) | |
53 | $(call if_changed_rule,cc_o_c) | |
500856eb | 54 | |
876b3cef | 55 | # Rule to build architecture-specific library assembly files |
9e414032 | 56 | $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S |
6825a95b | 57 | $(call if_changed_dep,as_o_S) |