3 # Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
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
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
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
20 include $(TOPDIR)Rules.mak
22 TARGETS = ldd ldconfig readelf
24 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
30 # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
32 ifeq ($(strip $(HAVE_SHARED)),y)
33 all: $(TARGETS) $(TARGET_ICONV)
39 @$(LN) -fs $(TOPDIR)include/elf.h
42 $(CC) $(CFLAGS) -Wl,-s $^ -o $@
43 $(STRIPTOOL) -x -R .note -R .comment $@
45 ldconfig: ldconfig.c readsoname.c
46 $(CC) $(CFLAGS) -Wl,-s -static \
47 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
48 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
50 $(STRIPTOOL) -x -R .note -R .comment $@
53 $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
54 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
55 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
57 $(STRIPTOOL) -x -R .note -R .comment $@
59 iconv: ../libc/misc/wchar/wchar.c
60 $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
63 $(STRIPTOOL) -x -R .note -R .comment $@
65 ifeq ($(strip $(HAVE_SHARED)),y)
66 hostutils: ldd.host ldconfig.host readelf.host
68 hostutils: readelf.host
72 $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
73 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
74 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
77 ldconfig.host: ldconfig.c readsoname.c
78 $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
79 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
80 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
83 readelf.host: readelf.c
84 $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
87 $(RM) $(TARGETS) *.o *~ core *.target elf.h iconv *.host
90 readelf.c readsoname.c ldconfig.c ldd.c: headers
93 ifeq ($(strip $(HAVE_SHARED)),y)
94 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
95 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
96 $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
97 $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig;
98 #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
100 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
101 $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv