1# Makefile for libcharset/lib
2
3#### Start of system configuration section. ####
4
5# Directories used by "make":
6srcdir = @srcdir@
7
8# Directories used by "make install":
9prefix = @prefix@
10local_prefix = /usr/local
11exec_prefix = @exec_prefix@
12libdir = @libdir@
13
14# Programs used by "make":
15CC = @CC@
16CFLAGS = @CFLAGS@
17CPPFLAGS = @CPPFLAGS@
18LDFLAGS = @LDFLAGS@
19INCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/..
20LIBTOOL = @LIBTOOL@
21LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
22LIBTOOL_LINK = $(LIBTOOL) --mode=link
23LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
24LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
25RM = rm -f
26
27# Programs used by "make install":
28INSTALL = @INSTALL@
29INSTALL_DATA = @INSTALL_DATA@
30MKINSTALLDIRS = $(SHELL) $(srcdir)/../autoconf/mkinstalldirs
31
32#### End of system configuration section. ####
33
34PACKAGE = @PACKAGE@
35VERSION = @VERSION@
36
37SHELL = /bin/sh
38
39# Before making a release, change this according to the libtool documentation,
40# section "Library interface versions".
41LIBCHARSET_VERSION_INFO = 1:0:0
42
43# Needed by $(LIBTOOL).
44top_builddir = ..
45
46SOURCES = $(srcdir)/localcharset.c
47
48OBJECTS = localcharset.lo
49
50all : libcharset.la charset.alias ref-add.sed ref-del.sed
51
52libcharset.la : $(OBJECTS)
53	$(LIBTOOL_LINK) $(CC) $(LDFLAGS) -o libcharset.la -rpath $(libdir) -version-info $(LIBCHARSET_VERSION_INFO) -no-undefined $(OBJECTS)
54
55localcharset.lo : $(srcdir)/localcharset.c
56	$(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H -DLIBDIR=\"$(libdir)\" -c $(srcdir)/localcharset.c
57
58charset.alias: $(srcdir)/config.charset
59	$(SHELL) $(srcdir)/config.charset '@host@' > t-$@
60	mv t-$@ $@
61
62ref-add.sed : $(srcdir)/ref-add.sin
63	sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-$@
64	mv t-$@ $@
65
66ref-del.sed : $(srcdir)/ref-del.sin
67	sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-$@
68	mv t-$@ $@
69
70# Installs the library and include files only. Typically called with only
71# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
72install-lib : all force
73	$(MKINSTALLDIRS) $(libdir)
74	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libcharset.la $(libdir)/libcharset.la
75	test -f $(libdir)/charset.alias && orig=$(libdir)/charset.alias \
76	                                || orig=charset.alias; \
77	sed -f ref-add.sed $$orig > $(libdir)/t-charset.alias; \
78	$(INSTALL_DATA) $(libdir)/t-charset.alias $(libdir)/charset.alias; \
79	rm -f $(libdir)/t-charset.alias
80
81# The following is needed in order to install a simple file in $(libdir)
82# which is shared with other installed packages. We use a list of referencing
83# packages so that "make uninstall" will remove the file if and only if it
84# is not used by another installed package.
85# On systems with glibc-2.1 or newer, the file is redundant, therefore we
86# avoid installing it.
87
88install : all force
89	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
90	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libcharset.la $(DESTDIR)$(libdir)/libcharset.la
91	if test -f $(DESTDIR)$(libdir)/charset.alias; then \
92	  sed -f ref-add.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \
93	  $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \
94	  rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
95	else \
96	  if test @GLIBC21@ = no; then \
97	    sed -f ref-add.sed charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \
98	    $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \
99	    rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
100	  fi ; \
101	fi
102
103installdirs : force
104	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
105
106uninstall : force
107	$(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libcharset.la
108	if test -f $(DESTDIR)$(libdir)/charset.alias; then \
109	  sed -f ref-del.sed $(DESTDIR)$(libdir)/charset.alias > $(DESTDIR)$(libdir)/t-charset.alias; \
110	  if grep '^# Packages using this file: $$' $(DESTDIR)$(libdir)/t-charset.alias > /dev/null; then \
111	    rm -f $(DESTDIR)$(libdir)/charset.alias; \
112	  else \
113	    $(INSTALL_DATA) $(DESTDIR)$(libdir)/t-charset.alias $(DESTDIR)$(libdir)/charset.alias; \
114	  fi; \
115	  rm -f $(DESTDIR)$(libdir)/t-charset.alias; \
116	fi
117
118check : all
119
120mostlyclean : clean
121
122clean : force
123	$(RM) *.o *.lo *.a *.la *.o.lock core charset.alias ref-add.sed ref-del.sed
124	$(RM) -r .libs _libs
125
126distclean : clean
127	$(RM) config.status config.log config.cache Makefile libtool
128
129maintainer-clean : distclean
130
131force :
132
133