OSDN Git Service

Link ldconfig with the appropriate libraries.
[uclinux-h8/uClibc.git] / utils / Makefile
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
4 #
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 # Pull in the user's uClibc configuration, but do not
20 # pull in Rules.mak.....
21 TOPDIR=../
22 include $(TOPDIR)Rules.mak
23
24 TARGETS = ldd ldconfig readelf
25
26 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
27 TARGET_ICONV = iconv
28 else
29 TARGET_ICONV =
30 endif
31
32 XXFLAGS=
33 ifeq ($(strip $(LDSO_LDD_SUPPORT)),y)
34 XXFLAGS= -D__LDSO_LDD_SUPPORT
35 else
36 XXFLAGS=
37 endif
38
39 ifeq ($(strip $(HAVE_SHARED)),y)
40 all:    $(TARGETS) $(TARGET_ICONV)
41 else
42 all:    $(TARGET_ICONV)
43 endif
44
45 headers:
46         $(LN) -fs $(TOPDIR)include/elf.h
47
48 readelf: readelf.c
49         $(CC) $(CFLAGS) -Wl,-s $^ -o $@ $(LDADD_LIBFLOAT) -L../lib
50         $(STRIPTOOL) -x -R .note -R .comment $@
51
52 ldconfig:       ldconfig.c readsoname.c
53         $(CC) $(CFLAGS) $(XXFLAGS) -Wl,-s -static \
54                 -DUCLIBC_RUNTIME_PREFIX=$(R_PREFIX) \
55                 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
56                 $^ -o $@ $(LDADD_LIBFLOAT) -L../lib
57         $(STRIPTOOL) -x -R .note -R .comment $@
58
59 ldd:    ldd.c
60         $(CC) $(CFLAGS) $(XXFLAGS) -Wl,-s \
61                 -DUCLIBC_RUNTIME_PREFIX=$(R_PREFIX) \
62                 -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
63                 $^ -o $@ $(LDADD_LIBFLOAT) -L../lib
64         $(STRIPTOOL) -x -R .note -R .comment $@
65
66 iconv: ../libc/misc/wchar/wchar.c
67         $(CC) $(CFLAGS) -DL_iconv_main ../libc/misc/wchar/wchar.c -o $@ \
68                 $(LDADD_LIBFLOAT) -L../lib
69         $(STRIPTOOL) -x -R .note -R .comment $@
70
71 clean:
72         $(RM) $(TARGETS) *.o *~ core *.target elf.h iconv
73
74
75 readelf.c readsoname.c ldconfig.c ldd.c:        headers
76
77 install: all
78 ifeq ($(strip $(HAVE_SHARED)),y)
79         $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
80         $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
81         $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
82         $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig;
83         # For now, don't bother with readelf since surely the host
84         # system has binutils, or we couldn't have gotten this far...
85         #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
86 endif
87 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
88         $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
89 endif