Remove dependency of xalloc on error, etc.
[platform/upstream/coreutils.git] / lib / Makefile.am
1 ## Makefile for gnulib/lib                              -*-Makefile-*-
2
3 # Copyright (C) 1995-2004 Free Software Foundation, Inc.
4
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA.
19
20 noinst_LIBRARIES = libfetish.a
21
22 AM_CPPFLAGS = -I.. -I$(srcdir)
23 DEFS += -DLIBDIR=\"$(libdir)\"
24
25 ## Put relatively complex files at the beginning of the list so
26 ## that parallel compiles finish a tiny bit sooner.  I don't see
27 ## a way to make regex.c appear earlier in the list, since it's
28 ## added by automake, but on systems with an up to date GNU libc,
29 ## regex.c isn't even compiled.
30 libfetish_a_SOURCES = \
31   acl.h acl.c \
32   getdate.h getdate.y \
33   posixtm.c posixtm.h \
34   posixver.c posixver.h \
35   strftime.c strftime.h \
36   getopt.c getopt.h getopt1.c getopt_int.h \
37   hash.c hash.h \
38   hash-pjw.c hash-pjw.h \
39   __fpending.h \
40   allocsa.c allocsa.h \
41   argmatch.c argmatch.h \
42   backupfile.c backupfile.h \
43   basename.c \
44   c-strtod.c c-strtod.h c-strtold.c \
45   canon-host.c \
46   canonicalize.c canonicalize.h \
47   cloexec.c cloexec.h \
48   closeout.c closeout.h \
49   cycle-check.c cycle-check.h \
50   dev-ino.h \
51   diacrit.c diacrit.h \
52   dirname.c dirname.h \
53   dirfd.h \
54   dup-safer.c \
55   euidaccess.h \
56   exclude.c exclude.h \
57   exit.h \
58   exitfail.c exitfail.h \
59   fcntl-safer.h \
60   filemode.c filemode.h \
61   file-type.c file-type.h \
62   fopen-safer.c \
63   fsusage.h \
64   fts.c fts_.h \
65   full-read.c full-read.h \
66   full-write.c full-write.h \
67   getline.h \
68   getpagesize.h \
69   gettime.c \
70   gettext.h \
71   getugroups.c \
72   group-member.h \
73   hard-locale.c hard-locale.h \
74   human.c human.h \
75   idcache.c \
76   imaxtostr.c \
77   lchown.h \
78   linebuffer.c linebuffer.h \
79   localcharset.c localcharset.h \
80   long-options.c long-options.h \
81   makepath.c makepath.h \
82   mbswidth.c mbswidth.h \
83   md5.c md5.h \
84   memcasecmp.c memcasecmp.h \
85   memcoll.c memcoll.h \
86   modechange.c modechange.h \
87   mountlist.h \
88   offtostr.c \
89   open-safer.c \
90   path-concat.c path-concat.h \
91   pathmax.h \
92   physmem.c physmem.h \
93   quote.c quote.h \
94   quotearg.c quotearg.h \
95   readtokens0.c readtokens0.h \
96   readtokens.c readtokens.h \
97   readutmp.h \
98   regex.h \
99   root-dev-ino.c root-dev-ino.h \
100   safe-read.c safe-read.h \
101   safe-write.c safe-write.h \
102   same.c same.h \
103   save-cwd.c save-cwd.h \
104   savedir.c savedir.h \
105   settime.c \
106   sha1.c sha1.h \
107   sig2str.h \
108   stat-macros.h \
109   stdio-safer.h \
110   stripslash.c \
111   strdup.h \
112   strndup.h \
113   strverscmp.h \
114   time_r.c time_r.h \
115   timespec.h \
116   umaxtostr.c \
117   unicodeio.c unicodeio.h \
118   unistd-safer.h \
119   unlocked-io.h \
120   userspec.c userspec.h \
121   utimecmp.c utimecmp.h \
122   utimens.c utimens.h \
123   version-etc.c version-etc.h \
124   xalloc.h \
125   xalloc-die.c \
126   xfts.c xfts.h \
127   xgetcwd.c xgetcwd.h \
128   xgethostname.c xgethostname.h \
129   xmalloc.c \
130   xmemcoll.c xmemcoll.h \
131   xnanosleep.c xnanosleep.h \
132   xreadlink.c xreadlink.h \
133   xstrdup.c  \
134   xstrndup.c xstrndup.h \
135   xstrtod.c xstrtod.h \
136   xstrtoimax.c \
137   xstrtol.c xstrtol.h \
138   xstrtoul.c \
139   xstrtoumax.c \
140   yesno.c yesno.h
141
142 libfetish_a_SOURCES += \
143   printf-args.h \
144   printf-parse.h \
145   vasprintf.h \
146   vasnprintf.h
147
148 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
149 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
150
151 lib_OBJECTS = $(libfetish_a_OBJECTS)
152
153
154 BUILT_SOURCES = getdate.c
155 CLEANFILES =
156 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
157 MOSTLYCLEANFILES =
158 SUFFIXES =
159
160 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
161   getndelim2.c getndelim2.h \
162   inttostr.c inttostr.h
163
164 # We need the following in order to install a simple file in $(libdir)
165 # which is shared with other installed packages. We use a list of referencing
166 # packages so that "make uninstall" will remove the file if and only if it
167 # is not used by another installed package.
168 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
169 # avoid installing it.
170
171 all-local: charset.alias ref-add.sed ref-del.sed
172
173 charset_alias = $(DESTDIR)$(libdir)/charset.alias
174 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
175 install-exec-local: all-local
176         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
177         if test -f $(charset_alias); then \
178           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
179           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
180           rm -f $(charset_tmp) ; \
181         else \
182           if test $(GLIBC21) = no; then \
183             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
184             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
185             rm -f $(charset_tmp) ; \
186           fi ; \
187         fi
188
189 uninstall-local: all-local
190         if test -f $(charset_alias); then \
191           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
192           if grep '^# Packages using this file: $$' $(charset_tmp) \
193               > /dev/null; then \
194             rm -f $(charset_alias); \
195           else \
196             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
197           fi; \
198           rm -f $(charset_tmp); \
199         fi
200
201 charset.alias: config.charset
202         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
203         mv t-$@ $@
204
205 SUFFIXES += .sed .sin
206 .sin.sed:
207         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
208         mv t-$@ $@
209
210 CLEANFILES += charset.alias ref-add.sed ref-del.sed
211
212 BUILT_SOURCES += $(STDBOOL_H)
213 EXTRA_DIST += stdbool_.h
214 MOSTLYCLEANFILES += stdbool.h stdbool.ht
215 # Create stdbool.h on systems that lack a working one.
216 stdbool.h: stdbool_.h
217         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
218         mv $@t $@
219
220 BUILT_SOURCES += $(ALLOCA_H)
221 EXTRA_DIST += alloca_.h
222
223 # We need the following in order to create an <alloca.h> when the system
224 # doesn't have one that works with the given compiler.
225 all-local $(lib_OBJECTS): $(ALLOCA_H)
226 alloca.h: alloca_.h
227         cp $(srcdir)/alloca_.h $@-t
228         mv $@-t $@
229 MOSTLYCLEANFILES += alloca.h alloca.h-t
230
231 BUILT_SOURCES += $(FNMATCH_H)
232 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
233
234 # We need the following in order to create an <fnmatch.h> when the system
235 # doesn't have one that supports the required API.
236 all-local $(lib_OBJECTS): $(FNMATCH_H)
237 fnmatch.h: fnmatch_.h
238         cp $(srcdir)/fnmatch_.h $@-t
239         mv $@-t $@
240 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t