8b35ea36cde4893664e709926104c69334cc0ddb
[gnulib.git] / lib / Makefile.am
1 ## Makefile for gnulib/lib                              -*-Makefile-*-
2
3 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free
4 # Software Foundation, Inc.
5
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2, or (at your option)
9 ## any later version.
10
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ## GNU General Public License for more details.
15
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, write to the Free Software
18 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 ## 02111-1307, USA.
20
21 AUTOMAKE_OPTIONS = ../src/ansi2knr
22
23 noinst_LIBRARIES = libfetish.a
24
25 INCLUDES = -I.. -I$(srcdir)
26 DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
27
28 ## Put relatively complex files at the beginning of the list so
29 ## that parallel compiles finish a tiny bit sooner.  I don't see
30 ## a way to make regex.c appear earlier in the list, since it's
31 ## added by automake, but on systems with an up to date GNU libc,
32 ## regex.c isn't even compiled.
33 libfetish_a_SOURCES = \
34   acl.h acl.c \
35   getdate.h getdate.y \
36   posixtm.c posixtm.h \
37   posixver.c posixver.h \
38   strftime.c \
39   getopt.c getopt.h getopt1.c \
40   hash.c hash.h \
41   hash-pjw.c hash-pjw.h \
42   __fpending.h \
43   addext.c \
44   argmatch.c argmatch.h \
45   backupfile.c backupfile.h \
46   basename.c \
47   bumpalloc.h \
48   canon-host.c \
49   c-stack.c c-stack.h \
50   closeout.c closeout.h \
51   diacrit.c diacrit.h \
52   dirname.c dirname.h \
53   dirfd.h \
54   dup-safer.c \
55   exclude.c exclude.h \
56   exitfail.c exitfail.h \
57   filemode.c filemode.h \
58   file-type.c file-type.h \
59   fnmatch_.h \
60   fopen-safer.c \
61   fsusage.h \
62   full-write.c full-write.h \
63   getline.h \
64   getpagesize.h \
65   getstr.c getstr.h \
66   gettime.c \
67   gettext.h \
68   getugroups.c \
69   group-member.h \
70   hard-locale.c hard-locale.h \
71   human.c human.h \
72   idcache.c \
73   isdir.c \
74   lchown.h \
75   linebuffer.c linebuffer.h \
76   localcharset.c \
77   long-options.c long-options.h \
78   makepath.c makepath.h \
79   mbswidth.c mbswidth.h \
80   md5.c md5.h \
81   memcasecmp.c memcasecmp.h \
82   memcoll.c memcoll.h \
83   modechange.c modechange.h \
84   mountlist.h \
85   path-concat.c path-concat.h \
86   pathmax.h \
87   physmem.c physmem.h \
88   quote.c quote.h \
89   quotearg.c quotearg.h \
90   readtokens.c readtokens.h \
91   readutmp.h \
92   regex.h \
93   safe-read.c safe-read.h \
94   same.c same.h \
95   save-cwd.c save-cwd.h \
96   savedir.c savedir.h \
97   setenv.c unsetenv.c setenv.h \
98   settime.c \
99   sha.c sha.h \
100   sig2str.h \
101   stdio-safer.h \
102   stripslash.c \
103   strverscmp.h \
104   timespec.h \
105   unicodeio.c unicodeio.h \
106   unistd-safer.h \
107   unlocked-io.h \
108   userspec.c \
109   version-etc.c version-etc.h \
110   xalloc.h \
111   xgetcwd.c \
112   xgethostname.c \
113   xmalloc.c \
114   xmemcoll.c xmemcoll.h \
115   xreadlink.c xreadlink.h \
116   xstrdup.c \
117   xstrtod.c xstrtod.h \
118   xstrtol.c xstrtol.h \
119   xstrtoul.c \
120   xstrtoimax.c \
121   xstrtoumax.c \
122   yesno.c
123
124 libfetish_a_LIBADD = @LIBOBJS@ @ALLOCA@
125 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
126
127
128 BUILT_SOURCES = getdate.c
129 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
130
131 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
132   fnmatch_loop.c
133
134 # The following is needed in order to install a simple file in $(libdir)
135 # which is shared with other installed packages. We use a list of referencing
136 # packages so that "make uninstall" will remove the file if and only if it
137 # is not used by another installed package.
138 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
139 # avoid installing it.
140
141 all-local: charset.alias ref-add.sed ref-del.sed
142
143 charset_alias = $(DESTDIR)$(libdir)/charset.alias
144 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
145 install-exec-local: all-local
146         $(mkinstalldirs) $(DESTDIR)$(libdir)
147         if test -f $(charset_alias); then \
148           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
149           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
150           rm -f $(charset_tmp) ; \
151         else \
152           if test @GLIBC21@ = no; then \
153             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
154             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
155             rm -f $(charset_tmp) ; \
156           fi ; \
157         fi
158
159 uninstall-local: all-local
160         if test -f $(charset_alias); then \
161           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
162           if grep '^# Packages using this file: $$' $(charset_tmp) \
163               > /dev/null; then \
164             rm -f $(charset_alias); \
165           else \
166             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
167           fi; \
168           rm -f $(charset_tmp); \
169         fi
170
171 charset.alias: config.charset
172         $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
173         mv t-$@ $@
174
175 SUFFIXES = .sed .sin
176 .sin.sed:
177         sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
178         mv t-$@ $@
179
180 CLEANFILES = charset.alias ref-add.sed ref-del.sed