1# Makefile for libiconv/src
2
3#### Start of system configuration section. ####
4
5# Directories used by "make":
6srcdir = @srcdir@
7top_srcdir = @top_srcdir@
8
9# Directories used by "make install":
10prefix = @prefix@
11local_prefix = /usr/local
12exec_prefix = @exec_prefix@
13bindir = @bindir@
14libdir = @libdir@
15datarootdir = @datarootdir@
16datadir = @datadir@
17localedir = @localedir@
18
19# Programs used by "make":
20CC = @CC@
21CFLAGS = @CFLAGS@
22CPPFLAGS = @CPPFLAGS@
23LDFLAGS = @LDFLAGS@
24INCLUDES = -I. -I$(srcdir) -I.. -I../include -I$(srcdir)/../include -I../srclib -I$(srcdir)/../srclib
25LIBTOOL = @LIBTOOL@
26LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
27LIBTOOL_LINK = $(LIBTOOL) --mode=link
28LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
29LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
30RM = rm -f
31@SET_MAKE@
32
33# Programs used by "make install":
34INSTALL = @INSTALL@
35INSTALL_PROGRAM = @INSTALL_PROGRAM@
36INSTALL_DATA = @INSTALL_DATA@
37mkinstalldirs = $(SHELL) @top_srcdir@/build-aux/mkinstalldirs
38
39#### End of system configuration section. ####
40
41SHELL = /bin/sh
42
43# Needed by $(LIBTOOL).
44top_builddir = ..
45
46# Needed by SET_RELOCATABLE.
47EXEEXT = @EXEEXT@
48
49# We cannot link with libintl until libiconv is installed. (When we call
50# libtool with arguments "../lib/libiconv.la -lintl", libtool will call ld
51# with "../lib/.libs/libiconv.so $libdir/libintl.so $libdir/libiconv.so",
52# (remember that $libdir/libintl.la lists $libdir/libiconv.so as a dependency),
53# and this gives a fatal linker error on Solaris because the two libiconv.so
54# files are different but have the same soname.
55# So we can link the iconv executable only after we have installed libiconv,
56# i.e. during "make install". The intermediate 'iconv' executable is built
57# without internationalization and not linked with libintl.
58
59all : iconv_no_i18n iconv.@OBJEXT@
60	test `ls -ld . | sed -e 's/^d\(.........\).*/\1/'` = rwxrwxrwx || chmod 777 .
61
62# This is the temporary iconv executable, without internationalization.
63iconv_no_i18n : iconv_no_i18n.@OBJEXT@ ../lib/libiconv.la
64	$(LIBTOOL_LINK) $(CC) $(LDFLAGS) iconv_no_i18n.@OBJEXT@ ../srclib/libicrt.a ../lib/libiconv.la -o $@
65
66iconv_no_i18n.@OBJEXT@ : $(srcdir)/iconv_no_i18n.c $(srcdir)/iconv.c
67	$(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) -DINSTALLDIR=\"$(bindir)\" -DLOCALEDIR=\"$(localedir)\" $(srcdir)/iconv_no_i18n.c
68
69iconv.@OBJEXT@ : $(srcdir)/iconv.c
70	$(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) -DINSTALLDIR=\"$(bindir)\" -DLOCALEDIR=\"$(localedir)\" $(srcdir)/iconv.c
71
72# The following rule is necessary to avoid a toplevel "make -n check" failure.
73../lib/libiconv.la :
74	cd ../lib && $(MAKE) libiconv.la
75
76# Support for relocatability.
77RELOCATABLE_LIBRARY_PATH = $(libdir)
78RELOCATABLE_SRC_DIR = $(top_srcdir)/srclib
79RELOCATABLE_BUILD_DIR = ../srclib
80RELOCATABLE_CONFIG_H_DIR = ..
81@SET_RELOCATABLE@
82iconv_LDFLAGS = `if test -n '$(RELOCATABLE_LDFLAGS)'; then $(RELOCATABLE_LDFLAGS) $(bindir); fi`
83
84# During "make install", we can build the final iconv executable.
85# On HP-UX, in order to ensure that the new libiconv.sl will override the old
86# one that is hardcoded in libintl.sl, we need to mention libiconv.sl before
87# libintl.sl on the link command line. We have to bypass libtool in order to
88# achieve this.
89# On Solaris, the linker gives an error if we are using libintl.so and it
90# refers to a libiconv.so in $prefix/lib since then it sees two libiconv.so's,
91# one in $prefix/lib and one in ../lib/.libs. So we have to avoid using
92# ../lib/libiconv.la entirely.
93install : all force
94	if [ ! -d $(DESTDIR)$(prefix) ] ; then $(mkinstalldirs) $(DESTDIR)$(prefix) ; fi
95	if [ ! -d $(DESTDIR)$(exec_prefix) ] ; then $(mkinstalldirs) $(DESTDIR)$(exec_prefix) ; fi
96	if [ ! -d $(DESTDIR)$(bindir) ] ; then $(mkinstalldirs) $(DESTDIR)$(bindir) ; fi
97	case "@host_os@" in \
98	  hpux*) $(CC) $(LDFLAGS) $(iconv_LDFLAGS) iconv.@OBJEXT@ ../srclib/libicrt.a -L$(DESTDIR)$(libdir) -liconv @LIBINTL@ `if test -n '$(DESTDIR)'; then echo " -Wl,+b -Wl,$(libdir)"; fi` -o iconv;; \
99	  *) $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(iconv_LDFLAGS) iconv.@OBJEXT@ ../srclib/libicrt.a $(DESTDIR)$(libdir)/libiconv.la @LTLIBINTL@ -o iconv;; \
100	esac
101	$(INSTALL_PROGRAM_ENV) $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) iconv $(DESTDIR)$(bindir)/iconv
102
103installdirs : force
104	if [ ! -d $(DESTDIR)$(prefix) ] ; then $(mkinstalldirs) $(DESTDIR)$(prefix) ; fi
105	if [ ! -d $(DESTDIR)$(exec_prefix) ] ; then $(mkinstalldirs) $(DESTDIR)$(exec_prefix) ; fi
106	if [ ! -d $(DESTDIR)$(bindir) ] ; then $(mkinstalldirs) $(DESTDIR)$(bindir) ; fi
107
108uninstall : force
109	$(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(bindir)/iconv
110
111check : all
112
113mostlyclean : clean
114
115clean : force
116	$(RM) *.@OBJEXT@ *.lo iconv_no_i18n iconv_no_i18n$(EXEEXT) iconv$(EXEEXT) core *.stackdump
117	$(RM) -r .libs _libs
118
119distclean : clean
120	$(RM) Makefile
121
122maintainer-clean : distclean
123
124force :
125
126