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 CFLAGS+=$(SSP_ALL_CFLAGS)
24 TARGETS = ldd ldconfig
26 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
32 # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
34 ifeq ($(strip $(HAVE_SHARED)),y)
35 all: $(TARGETS) $(TARGET_ICONV)
41 @$(LN) -fs $(TOPDIR)include/elf.h
43 readelf.c ldconfig.c ldd.c: headers
46 $(CC) $(CFLAGS) $^ -o $@
47 $(STRIPTOOL) -s -x -R .note -R .comment $@
49 ifeq ($(strip $(UCLIBC_STATIC_LDCONFIG)),y)
50 LDCONFIG_CFLAGS := -static
52 LDCONFIG_CFLAGS := $(PIEFLAG) $(LDPIEFLAG)
55 $(CC) $(CFLAGS) $(LDCONFIG_CFLAGS) \
56 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
57 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
59 $(STRIPTOOL) -s -x -R .note -R .comment $@
62 $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) \
63 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
64 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
66 $(STRIPTOOL) -s -x -R .note -R .comment $@
68 iconv: ../libc/misc/wchar/wchar.c
69 $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) \
72 $(STRIPTOOL) -s -x -R .note -R .comment $@
74 ifeq ($(strip $(HAVE_SHARED)),y)
75 hostutils: ldd.host ldconfig.host readelf.host
77 hostutils: readelf.host
81 $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
82 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
83 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
86 ldconfig.host: ldconfig.c
87 $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
88 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
89 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
92 readelf.host: readelf.c
93 $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
96 $(RM) $(TARGETS) *.o *~ core *.target elf.h iconv *.host
99 ifeq ($(strip $(HAVE_SHARED)),y)
100 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
101 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
102 $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
103 $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig;
104 #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
106 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
107 $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv