]> git.ipfire.org Git - people/ms/u-boot.git/blame - api_examples/Makefile
api_examples/Makefile: Get rid of unnecessary intermediate LIB target
[people/ms/u-boot.git] / api_examples / 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
23ifeq ($(ARCH),ppc)
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
500856eb
RJ
34
35#CFLAGS += -v
36
0dc1fc22 37SOBJS-$(CONFIG_API) += crt0.o
117d0ab5 38COBJS-$(CONFIG_API) += demo.o
500856eb 39ifeq ($(ARCH),ppc)
0dc1fc22 40SOBJS-$(CONFIG_API) += ppcstring.o
500856eb 41endif
117d0ab5
PT
42
43OUTPUT := $(OUTPUT-y)
0dc1fc22
RJ
44COBJS := $(COBJS-y)
45SOBJS := $(SOBJS-y)
500856eb 46
644cb381
PT
47LIBCOBJS-$(CONFIG_API) += glue.o
48LIBCOBJS-$(CONFIG_API) += crc32.o
49LIBCOBJS-$(CONFIG_API) += ctype.o
50LIBCOBJS-$(CONFIG_API) += string.o
51LIBCOBJS-$(CONFIG_API) += vsprintf.o
52LIBCOBJS-$(CONFIG_API) += libgenwrap.o
0dc1fc22 53LIBCOBJS := $(LIBCOBJS-y)
500856eb 54
644cb381 55LIBOBJS += $(addprefix $(obj),$(SOBJS))
522f6f02 56LIBOBJS += $(addprefix $(obj),$(COBJS))
644cb381 57LIBOBJS += $(addprefix $(obj),$(LIBCOBJS))
500856eb 58
644cb381
PT
59SRCS += $(COBJS:.o=.c)
60SRCS += $(LIBCOBJS:.o=.c)
61SRCS += $(SOBJS:.o=.S)
500856eb 62OBJS := $(addprefix $(obj),$(COBJS))
500856eb
RJ
63
64gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
65
66CPPFLAGS += -I..
67
522f6f02 68all: $(obj).depend $(OBJS) $(OUTPUT)
500856eb
RJ
69
70#########################################################################
522f6f02
PT
71
72$(OUTPUT): $(LIBOBJS)
73 $(LD) -Ttext $(LOAD_ADDR) -o $@ $^ -L$(gcclibdir) -lgcc
117d0ab5 74 $(OBJCOPY) -O binary $@ $(OUTPUT).bin 2>/dev/null
500856eb 75
d3a6532c 76$(obj)crc32.c:
500856eb
RJ
77 @rm -f $(obj)crc32.c
78 ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
79
80$(obj)ctype.c:
81 @rm -f $(obj)ctype.c
82 ln -s $(src)../lib_generic/ctype.c $(obj)ctype.c
83
84$(obj)string.c:
85 @rm -f $(obj)string.c
86 ln -s $(src)../lib_generic/string.c $(obj)string.c
87
88$(obj)vsprintf.c:
89 @rm -f $(obj)vsprintf.c
90 ln -s $(src)../lib_generic/vsprintf.c $(obj)vsprintf.c
91
92ifeq ($(ARCH),ppc)
93$(obj)ppcstring.S:
94 @rm -f $(obj)ppcstring.S
95 ln -s $(src)../lib_ppc/ppcstring.S $(obj)ppcstring.S
96endif
97
98#########################################################################
99
100# defines $(obj).depend target
101include $(SRCTREE)/rules.mk
102
103sinclude $(obj).depend
104
105#########################################################################