]> git.ipfire.org Git - people/ms/u-boot.git/blame - examples/api/Makefile
Licenses: introduce SPDX Unique Lincense Identifiers
[people/ms/u-boot.git] / examples / api / Makefile
CommitLineData
500856eb
RJ
1#
2# (C) Copyright 2007 Semihalf
3#
4# See file CREDITS for list of people who contributed to this
5# project.
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundatio; either version 2 of
10# the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20# MA 02111-1307 USA
21#
22
a47a12be 23ifeq ($(ARCH),powerpc)
500856eb
RJ
24LOAD_ADDR = 0x40000
25endif
7fb6c4f9
RJ
26ifeq ($(ARCH),arm)
27LOAD_ADDR = 0x1000000
28endif
500856eb
RJ
29
30include $(TOPDIR)/config.mk
31
117d0ab5
PT
32# Resulting ELF and binary exectuables will be named demo and demo.bin
33OUTPUT-$(CONFIG_API) = $(obj)demo
876b3cef
PT
34OUTPUT = $(OUTPUT-y)
35
d4abc757 36# Source files located in the examples/api directory
876b3cef
PT
37SOBJ_FILES-$(CONFIG_API) += crt0.o
38COBJ_FILES-$(CONFIG_API) += demo.o
39COBJ_FILES-$(CONFIG_API) += glue.o
40COBJ_FILES-$(CONFIG_API) += libgenwrap.o
41
d4abc757 42# Source files which exist outside the examples/api directory
78acc472
PT
43EXT_COBJ_FILES-$(CONFIG_API) += lib/crc32.o
44EXT_COBJ_FILES-$(CONFIG_API) += lib/ctype.o
45EXT_COBJ_FILES-$(CONFIG_API) += lib/div64.o
46EXT_COBJ_FILES-$(CONFIG_API) += lib/string.o
47EXT_COBJ_FILES-$(CONFIG_API) += lib/time.o
48EXT_COBJ_FILES-$(CONFIG_API) += lib/vsprintf.o
a47a12be
SR
49ifeq ($(ARCH),powerpc)
50EXT_SOBJ_FILES-$(CONFIG_API) += arch/powerpc/lib/ppcstring.o
500856eb 51endif
117d0ab5 52
876b3cef
PT
53# Create a list of source files so their dependencies can be auto-generated
54SRCS += $(addprefix $(SRCTREE)/,$(EXT_COBJ_FILES-y:.o=.c))
55SRCS += $(addprefix $(SRCTREE)/,$(EXT_SOBJ_FILES-y:.o=.S))
d4abc757
PT
56SRCS += $(addprefix $(SRCTREE)/examples/api/,$(COBJ_FILES-y:.o=.c))
57SRCS += $(addprefix $(SRCTREE)/examples/api/,$(SOBJ_FILES-y:.o=.S))
500856eb 58
876b3cef
PT
59# Create a list of object files to be compiled
60OBJS += $(addprefix $(obj),$(SOBJ_FILES-y))
61OBJS += $(addprefix $(obj),$(COBJ_FILES-y))
62OBJS += $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))
63OBJS += $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y)))
500856eb 64
500856eb
RJ
65CPPFLAGS += -I..
66
876b3cef 67all: $(obj).depend $(OUTPUT)
500856eb
RJ
68
69#########################################################################
522f6f02 70
876b3cef 71$(OUTPUT): $(OBJS)
349e83f0 72 $(LD) -Ttext $(LOAD_ADDR) -o $@ $^ $(PLATFORM_LIBS)
117d0ab5 73 $(OBJCOPY) -O binary $@ $(OUTPUT).bin 2>/dev/null
500856eb 74
876b3cef 75# Rule to build generic library C files
78acc472 76$(obj)%.o: $(SRCTREE)/lib/%.c
876b3cef 77 $(CC) -g $(CFLAGS) -c -o $@ $<
500856eb 78
876b3cef 79# Rule to build architecture-specific library assembly files
ea0364f1 80$(obj)%.o: $(SRCTREE)/arch/$(ARCH)/lib/%.S
876b3cef 81 $(CC) -g $(CFLAGS) -c -o $@ $<
500856eb
RJ
82
83#########################################################################
84
85# defines $(obj).depend target
86include $(SRCTREE)/rules.mk
87
88sinclude $(obj).depend
89
90#########################################################################