]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - api_examples/Makefile
Coding Style cleanup; update CHANGELOG
[karo-tx-uboot.git] / api_examples / Makefile
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
23 ifeq ($(ARCH),ppc)
24 LOAD_ADDR = 0x40000
25 endif
26
27 #ifeq ($(ARCH),arm)
28 #LOAD_ADDR = 0xc100000
29 #endif
30
31 include $(TOPDIR)/config.mk
32
33 ELF     += demo
34 BIN     += demo.bin
35
36 #CFLAGS += -v
37
38 COBJS   := $(ELF:=.o)
39 SOBJS   := crt0.o
40 ifeq ($(ARCH),ppc)
41 SOBJS   += ppcstring.o
42 endif
43
44 LIB     = $(obj)libglue.a
45 LIBCOBJS= glue.o crc32.o ctype.o string.o vsprintf.o libgenwrap.o
46
47 LIBOBJS = $(addprefix $(obj),$(SOBJS) $(LIBCOBJS))
48
49 SRCS    := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(SOBJS:.o=.S)
50 OBJS    := $(addprefix $(obj),$(COBJS))
51 ELF     := $(addprefix $(obj),$(ELF))
52 BIN     := $(addprefix $(obj),$(BIN))
53
54 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
55
56 CPPFLAGS += -I..
57
58 all:    $(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
90 ifeq ($(ARCH),ppc)
91 $(obj)ppcstring.S:
92         @rm -f $(obj)ppcstring.S
93         ln -s $(src)../lib_ppc/ppcstring.S $(obj)ppcstring.S
94 endif
95
96 #########################################################################
97
98 # defines $(obj).depend target
99 include $(SRCTREE)/rules.mk
100
101 sinclude $(obj).depend
102
103 #########################################################################