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