]> git.ipfire.org Git - people/ms/u-boot.git/blame - api_examples/Makefile
API for external applications.
[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
26
27#ifeq ($(ARCH),arm)
28#LOAD_ADDR = 0xc100000
29#endif
30
31include $(TOPDIR)/config.mk
32
33ELF += demo
34BIN += demo.bin
35
36#CFLAGS += -v
37
38COBJS := $(ELF:=.o)
39SOBJS := crt0.o
40ifeq ($(ARCH),ppc)
41SOBJS += ppcstring.o
42endif
43
44LIB = $(obj)libglue.a
45LIBCOBJS= glue.o crc32.o ctype.o string.o vsprintf.o libgenwrap.o
46
47LIBOBJS = $(addprefix $(obj),$(SOBJS) $(LIBCOBJS))
48
49SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(SOBJS:.o=.S)
50OBJS := $(addprefix $(obj),$(COBJS))
51ELF := $(addprefix $(obj),$(ELF))
52BIN := $(addprefix $(obj),$(BIN))
53
54gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
55
56CPPFLAGS += -I..
57
58all: $(obj).depend $(OBJS) $(LIB) $(BIN) $(ELF)
59
60#########################################################################
61$(LIB): $(obj).depend $(LIBOBJS)
62 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
63
64$(ELF):
65$(obj)%: $(obj)%.o $(LIB)
66 $(LD) $(obj)crt0.o -Ttext $(LOAD_ADDR) \
67 -o $@ $< $(LIB) \
68 -L$(gcclibdir) -lgcc
69
70$(BIN):
71$(obj)%.bin: $(obj)%
72 $(OBJCOPY) -O binary $< $@ 2>/dev/null
73
74$(obj)crc32.c:
75 @rm -f $(obj)crc32.c
76 ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
77
78$(obj)ctype.c:
79 @rm -f $(obj)ctype.c
80 ln -s $(src)../lib_generic/ctype.c $(obj)ctype.c
81
82$(obj)string.c:
83 @rm -f $(obj)string.c
84 ln -s $(src)../lib_generic/string.c $(obj)string.c
85
86$(obj)vsprintf.c:
87 @rm -f $(obj)vsprintf.c
88 ln -s $(src)../lib_generic/vsprintf.c $(obj)vsprintf.c
89
90ifeq ($(ARCH),ppc)
91$(obj)ppcstring.S:
92 @rm -f $(obj)ppcstring.S
93 ln -s $(src)../lib_ppc/ppcstring.S $(obj)ppcstring.S
94endif
95
96#########################################################################
97
98# defines $(obj).depend target
99include $(SRCTREE)/rules.mk
100
101sinclude $(obj).depend
102
103#########################################################################