Merge from gnulib.
[platform/upstream/coreutils.git] / lib / Makefile.am
1 ## Makefile for gnulib/lib                              -*-Makefile-*-
2
3 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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 noinst_LIBRARIES = libfetish.a
22
23 AM_CPPFLAGS = -I.. -I$(srcdir)
24 DEFS += -DLIBDIR=\"$(libdir)\"
25
26 ## Put relatively complex files at the beginning of the list so
27 ## that parallel compiles finish a tiny bit sooner.  I don't see
28 ## a way to make regex.c appear earlier in the list, since it's
29 ## added by automake, but on systems with an up to date GNU libc,
30 ## regex.c isn't even compiled.
31 libfetish_a_SOURCES = \
32   acl.h acl.c \
33   getdate.h getdate.y \
34   posixtm.c posixtm.h \
35   posixver.c posixver.h \
36   strftime.c strftime.h \
37   getopt.c getopt.h getopt1.c \
38   hash.c hash.h \
39   hash-pjw.c hash-pjw.h \
40   __fpending.h \
41   addext.c \
42   argmatch.c argmatch.h \
43   backupfile.c backupfile.h \
44   basename.c \
45   canon-host.c \
46   canonicalize.h \
47   closeout.c closeout.h \
48   cycle-check.c cycle-check.h \
49   dev-ino.h \
50   diacrit.c diacrit.h \
51   dirname.c dirname.h \
52   dirfd.h \
53   dup-safer.c \
54   euidaccess.h \
55   exclude.c exclude.h \
56   exitfail.c exitfail.h \
57   filemode.c filemode.h \
58   file-type.c file-type.h \
59   fopen-safer.c \
60   fsusage.h \
61   ftw_.h \
62   full-read.c full-read.h \
63   full-write.c full-write.h \
64   getline.h \
65   getpagesize.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   imaxtostr.c \
75   lchown.h \
76   linebuffer.c linebuffer.h \
77   localcharset.c localcharset.h \
78   long-options.c long-options.h \
79   makepath.c makepath.h \
80   mbswidth.c mbswidth.h \
81   md5.c md5.h \
82   memcasecmp.c memcasecmp.h \
83   memcoll.c memcoll.h \
84   modechange.c modechange.h \
85   mountlist.h \
86   offtostr.c \
87   path-concat.c path-concat.h \
88   pathmax.h \
89   physmem.c physmem.h \
90   quote.c quote.h \
91   quotearg.c quotearg.h \
92   readtokens.c readtokens.h \
93   readutmp.h \
94   regex.h \
95   safe-read.c safe-read.h \
96   safe-write.c safe-write.h \
97   same.c same.h \
98   save-cwd.c save-cwd.h \
99   savedir.c savedir.h \
100   search_.h \
101   settime.c \
102   sha.c sha.h \
103   sig2str.h \
104   stdio-safer.h \
105   stripslash.c \
106   strverscmp.h \
107   timespec.h \
108   umaxtostr.c \
109   unicodeio.c unicodeio.h \
110   unistd-safer.h \
111   unlocked-io.h \
112   userspec.c \
113   utimens.c utimens.h \
114   version-etc.c version-etc.h \
115   xalloc.h \
116   xgetcwd.c xgetcwd.h \
117   xgethostname.c \
118   xmalloc.c \
119   xmemcoll.c xmemcoll.h \
120   xnanosleep.c xnanosleep.h \
121   xreadlink.c xreadlink.h \
122   xstrdup.c \
123   xstrndup.c xstrndup.h \
124   xstrtod.c xstrtod.h \
125   xstrtol.c xstrtol.h \
126   xstrtoul.c \
127   xstrtoumax.c \
128   yesno.c
129
130 libfetish_a_SOURCES += \
131   printf-args.h \
132   printf-parse.h \
133   vasprintf.h \
134   vasnprintf.h
135
136 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
137 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
138
139 lib_OBJECTS = $(libfetish_a_OBJECTS)
140
141
142 BUILT_SOURCES = getdate.c
143 CLEANFILES =
144 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
145 MOSTLYCLEANFILES =
146 SUFFIXES =
147
148 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
149   getndelim2.c getndelim2.h \
150   inttostr.c inttostr.h
151
152 # We need the following in order to install a simple file in $(libdir)
153 # which is shared with other installed packages. We use a list of referencing
154 # packages so that "make uninstall" will remove the file if and only if it
155 # is not used by another installed package.
156 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
157 # avoid installing it.
158
159 all-local: charset.alias ref-add.sed ref-del.sed
160
161 charset_alias = $(DESTDIR)$(libdir)/charset.alias
162 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
163 install-exec-local: all-local
164         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
165         if test -f $(charset_alias); then \
166           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
167           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
168           rm -f $(charset_tmp) ; \
169         else \
170           if test $(GLIBC21) = no; then \
171             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
172             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
173             rm -f $(charset_tmp) ; \
174           fi ; \
175         fi
176
177 uninstall-local: all-local
178         if test -f $(charset_alias); then \
179           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
180           if grep '^# Packages using this file: $$' $(charset_tmp) \
181               > /dev/null; then \
182             rm -f $(charset_alias); \
183           else \
184             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
185           fi; \
186           rm -f $(charset_tmp); \
187         fi
188
189 charset.alias: config.charset
190         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
191         mv t-$@ $@
192
193 SUFFIXES += .sed .sin
194 .sin.sed:
195         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
196         mv t-$@ $@
197
198 CLEANFILES += charset.alias ref-add.sed ref-del.sed
199
200 BUILT_SOURCES += $(STDBOOL_H)
201 EXTRA_DIST += stdbool_.h
202 MOSTLYCLEANFILES += stdbool.h stdbool.ht
203 # Create stdbool.h on systems that lack a working one.
204 stdbool.h: stdbool_.h
205         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
206         mv $@t $@
207
208 BUILT_SOURCES += $(ALLOCA_H)
209 EXTRA_DIST += alloca_.h
210
211 # We need the following in order to create an <alloca.h> when the system
212 # doesn't have one that works with the given compiler.
213 all-local $(lib_OBJECTS): $(ALLOCA_H)
214 alloca.h: alloca_.h
215         cp $(srcdir)/alloca_.h $@-t
216         mv $@-t $@
217 MOSTLYCLEANFILES += alloca.h alloca.h-t
218
219 BUILT_SOURCES += $(FNMATCH_H)
220 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
221
222 # We need the following in order to create an <fnmatch.h> when the system
223 # doesn't have one that supports the required API.
224 all-local $(lib_OBJECTS): $(FNMATCH_H)
225 fnmatch.h: fnmatch_.h
226         cp $(srcdir)/fnmatch_.h $@-t
227         mv $@-t $@
228 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
229
230 DISTCLEANFILES = ftw.h search.h