OSDN Git Service

Peter Mazinger writes:
[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 # do we really need to reset XXFLAGS?
33 XXFLAGS=
34
35 ifeq ($(strip $(HAVE_SHARED)),y)
36 all:    $(TARGETS) $(TARGET_ICONV)
37 else
38 all:    $(TARGET_ICONV)
39 endif
40
41 headers:
42         @$(LN) -fs $(TOPDIR)include/elf.h
43
44 readelf: readelf.c
45         $(CC) $(CFLAGS) -Wl,-s $^ -o $@ $(LDADD_LIBFLOAT) -L../lib
46         $(STRIPTOOL) -x -R .note -R .comment $@
47
48 ldconfig:       ldconfig.c readsoname.c
49         $(CC) $(CFLAGS) $(XXFLAGS) -Wl,-s -static \
50                 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
51                 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
52                 -nostdlib -o $@ $(STATIC_BIN_START_FILES) $^ $(LDADD_LIBFLOAT) \
53                 -L../lib -lc $(LIBGCC) $(STATIC_BIN_END_FILES)
54         $(STRIPTOOL) -x -R .note -R .comment $@
55
56 ldd:    ldd.c
57         $(CC) $(CFLAGS) $(XXFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
58                 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
59                 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
60                 -nostdlib -o $@ $(BIN_START_FILES) $^ $(LDADD_LIBFLOAT) \
61                 -L../lib -lc $(LIBGCC) $(END_FILES)
62         $(STRIPTOOL) -x -R .note -R .comment $@
63
64 iconv: ../libc/misc/wchar/wchar.c
65         $(CC) $(CFLAGS) $(XXFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s -DL_iconv_main \
66                 -nostdlib -o $@ $(BIN_START_FILES) $^ $(LDADD_LIBFLOAT) \
67                 -L../lib -lc $(LIBGCC) $(END_FILES)
68         $(STRIPTOOL) -x -R .note -R .comment $@
69
70 hostutils: ldd.host ldconfig.host readelf.host
71
72 ldd.host:       ldd.c
73         $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
74                 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
75                 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
76                 $^ -o $@
77
78 ldconfig.host:  ldconfig.c readsoname.c
79         $(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
80                 -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
81                 -DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
82                 $^ -o $@
83
84 readelf.host: readelf.c
85         $(HOSTCC) $(HOSTCFLAGS) -Wl,-s $^ -o $@
86
87 clean:
88         $(RM) $(TARGETS) *.o *~ core *.target elf.h iconv *.host
89
90
91 readelf.c readsoname.c ldconfig.c ldd.c:        headers
92
93 install: all
94 ifeq ($(strip $(HAVE_SHARED)),y)
95         $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
96         $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
97         $(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
98         $(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig;
99         # For now, don't bother with readelf since surely the host
100         # system has binutils, or we couldn't have gotten this far...
101         #$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
102 endif
103 ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
104         $(INSTALL) -m 755 iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
105 endif