]> git.ipfire.org Git - people/ms/u-boot.git/blame - examples/api/Makefile
Add GPL-2.0+ SPDX-License-Identifier to source files
[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
a47a12be 7ifeq ($(ARCH),powerpc)
500856eb
RJ
8LOAD_ADDR = 0x40000
9endif
7fb6c4f9
RJ
10ifeq ($(ARCH),arm)
11LOAD_ADDR = 0x1000000
12endif
500856eb
RJ
13
14include $(TOPDIR)/config.mk
15
117d0ab5
PT
16# Resulting ELF and binary exectuables will be named demo and demo.bin
17OUTPUT-$(CONFIG_API) = $(obj)demo
876b3cef
PT
18OUTPUT = $(OUTPUT-y)
19
d4abc757 20# Source files located in the examples/api directory
876b3cef
PT
21SOBJ_FILES-$(CONFIG_API) += crt0.o
22COBJ_FILES-$(CONFIG_API) += demo.o
23COBJ_FILES-$(CONFIG_API) += glue.o
24COBJ_FILES-$(CONFIG_API) += libgenwrap.o
25
d4abc757 26# Source files which exist outside the examples/api directory
78acc472
PT
27EXT_COBJ_FILES-$(CONFIG_API) += lib/crc32.o
28EXT_COBJ_FILES-$(CONFIG_API) += lib/ctype.o
29EXT_COBJ_FILES-$(CONFIG_API) += lib/div64.o
30EXT_COBJ_FILES-$(CONFIG_API) += lib/string.o
31EXT_COBJ_FILES-$(CONFIG_API) += lib/time.o
32EXT_COBJ_FILES-$(CONFIG_API) += lib/vsprintf.o
a47a12be
SR
33ifeq ($(ARCH),powerpc)
34EXT_SOBJ_FILES-$(CONFIG_API) += arch/powerpc/lib/ppcstring.o
500856eb 35endif
117d0ab5 36
876b3cef
PT
37# Create a list of source files so their dependencies can be auto-generated
38SRCS += $(addprefix $(SRCTREE)/,$(EXT_COBJ_FILES-y:.o=.c))
39SRCS += $(addprefix $(SRCTREE)/,$(EXT_SOBJ_FILES-y:.o=.S))
d4abc757
PT
40SRCS += $(addprefix $(SRCTREE)/examples/api/,$(COBJ_FILES-y:.o=.c))
41SRCS += $(addprefix $(SRCTREE)/examples/api/,$(SOBJ_FILES-y:.o=.S))
500856eb 42
876b3cef
PT
43# Create a list of object files to be compiled
44OBJS += $(addprefix $(obj),$(SOBJ_FILES-y))
45OBJS += $(addprefix $(obj),$(COBJ_FILES-y))
46OBJS += $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))
47OBJS += $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y)))
500856eb 48
500856eb
RJ
49CPPFLAGS += -I..
50
876b3cef 51all: $(obj).depend $(OUTPUT)
500856eb
RJ
52
53#########################################################################
522f6f02 54
876b3cef 55$(OUTPUT): $(OBJS)
349e83f0 56 $(LD) -Ttext $(LOAD_ADDR) -o $@ $^ $(PLATFORM_LIBS)
117d0ab5 57 $(OBJCOPY) -O binary $@ $(OUTPUT).bin 2>/dev/null
500856eb 58
876b3cef 59# Rule to build generic library C files
78acc472 60$(obj)%.o: $(SRCTREE)/lib/%.c
876b3cef 61 $(CC) -g $(CFLAGS) -c -o $@ $<
500856eb 62
876b3cef 63# Rule to build architecture-specific library assembly files
ea0364f1 64$(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
876b3cef 65 $(CC) -g $(CFLAGS) -c -o $@ $<
500856eb
RJ
66
67#########################################################################
68
69# defines $(obj).depend target
70include $(SRCTREE)/rules.mk
71
72sinclude $(obj).depend
73
74#########################################################################