(libfetish_a_SOURCES): Add version-etc-fsf.c.
[platform/upstream/coreutils.git] / lib / Makefile.am
1 ## Makefile for gnulib/lib                              -*-Makefile-*-
2
3 # Copyright (C) 1995-2005 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 noinst_PROGRAMS = t-fpending
23 LDADD = $(noinst_LIBRARIES)
24
25 AM_CPPFLAGS = -I.. -I$(srcdir)
26 DEFS += -DLIBDIR=\"$(libdir)\"
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 strftime.h \
39   hash.c hash.h \
40   hash-pjw.c hash-pjw.h \
41   __fpending.h \
42   allocsa.c allocsa.h \
43   argmatch.c argmatch.h \
44   backupfile.c backupfile.h \
45   basename.c \
46   c-strtod.c c-strtod.h c-strtold.c \
47   canon-host.c \
48   canonicalize.c canonicalize.h \
49   cloexec.c cloexec.h \
50   closeout.c closeout.h \
51   cycle-check.c cycle-check.h \
52   dev-ino.h \
53   diacrit.c diacrit.h \
54   dirname.c dirname.h \
55   dirfd.h \
56   dup-safer.c \
57   euidaccess.h \
58   exclude.c exclude.h \
59   exit.h \
60   exitfail.c exitfail.h \
61   fcntl-safer.h \
62   filemode.c filemode.h \
63   file-type.c file-type.h \
64   fopen-safer.c \
65   fsusage.h \
66   fts.c fts_.h \
67   full-read.c full-read.h \
68   full-write.c full-write.h \
69   getcwd.h \
70   getline.h \
71   getpagesize.h \
72   getpass.h \
73   gettime.c \
74   gettext.h \
75   getugroups.c \
76   group-member.h \
77   hard-locale.c hard-locale.h \
78   human.c human.h \
79   idcache.c \
80   imaxtostr.c \
81   linebuffer.c linebuffer.h \
82   localcharset.c localcharset.h \
83   long-options.c long-options.h \
84   makepath.c makepath.h \
85   mbswidth.c mbswidth.h \
86   md5.c md5.h \
87   memcasecmp.c memcasecmp.h \
88   memcoll.c memcoll.h \
89   modechange.c modechange.h \
90   mountlist.h \
91   offtostr.c \
92   open-safer.c \
93   path-concat.c path-concat.h \
94   pathmax.h \
95   physmem.c physmem.h \
96   quote.c quote.h \
97   quotearg.c quotearg.h \
98   readtokens0.c readtokens0.h \
99   readtokens.c readtokens.h \
100   readutmp.h \
101   regex.h \
102   root-dev-ino.c root-dev-ino.h \
103   safe-read.c safe-read.h \
104   safe-write.c safe-write.h \
105   same.c same.h \
106   savedir.c savedir.h \
107   setenv.h \
108   settime.c \
109   sha1.c sha1.h \
110   sig2str.h \
111   stat-macros.h \
112   stdio-safer.h \
113   stripslash.c \
114   strdup.h \
115   strndup.h \
116   strverscmp.h \
117   time_r.c time_r.h \
118   timespec.h \
119   umaxtostr.c \
120   unicodeio.c unicodeio.h \
121   unistd-safer.h \
122   unlocked-io.h \
123   userspec.c userspec.h \
124   utimecmp.c utimecmp.h \
125   utimens.c utimens.h \
126   version-etc.c version-etc.h version-etc-fsf.c \
127   xalloc.h \
128   xalloc-die.c \
129   xfts.c xfts.h \
130   xgetcwd.c xgetcwd.h \
131   xgethostname.c xgethostname.h \
132   xmalloc.c \
133   xmemcoll.c xmemcoll.h \
134   xnanosleep.c xnanosleep.h \
135   xreadlink.c xreadlink.h \
136   xstrndup.c xstrndup.h \
137   xstrtod.c xstrtod.h \
138   xstrtoimax.c \
139   xstrtol.c xstrtol.h \
140   xstrtoul.c \
141   xstrtoumax.c \
142   yesno.c yesno.h
143
144 libfetish_a_SOURCES += \
145   printf-args.h \
146   printf-parse.h \
147   vasprintf.h \
148   vasnprintf.h
149
150 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
151 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
152
153 lib_OBJECTS = $(libfetish_a_OBJECTS)
154
155
156 BUILT_SOURCES = getdate.c
157 CLEANFILES =
158 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
159 MOSTLYCLEANFILES =
160 SUFFIXES =
161
162 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
163   getndelim2.c getndelim2.h \
164   inttostr.c inttostr.h
165
166 # We need the following in order to install a simple file in $(libdir)
167 # which is shared with other installed packages. We use a list of referencing
168 # packages so that "make uninstall" will remove the file if and only if it
169 # is not used by another installed package.
170 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
171 # avoid installing it.
172
173 all-local: charset.alias ref-add.sed ref-del.sed
174
175 charset_alias = $(DESTDIR)$(libdir)/charset.alias
176 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
177 install-exec-local: all-local
178         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
179         if test -f $(charset_alias); then \
180           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
181           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
182           rm -f $(charset_tmp) ; \
183         else \
184           if test $(GLIBC21) = no; then \
185             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
186             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
187             rm -f $(charset_tmp) ; \
188           fi ; \
189         fi
190
191 uninstall-local: all-local
192         if test -f $(charset_alias); then \
193           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
194           if grep '^# Packages using this file: $$' $(charset_tmp) \
195               > /dev/null; then \
196             rm -f $(charset_alias); \
197           else \
198             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
199           fi; \
200           rm -f $(charset_tmp); \
201         fi
202
203 charset.alias: config.charset
204         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
205         mv t-$@ $@
206
207 SUFFIXES += .sed .sin
208 .sin.sed:
209         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
210         mv t-$@ $@
211
212 CLEANFILES += charset.alias ref-add.sed ref-del.sed
213
214 BUILT_SOURCES += $(STDBOOL_H)
215 EXTRA_DIST += stdbool_.h
216 MOSTLYCLEANFILES += stdbool.h stdbool.ht
217 # Create stdbool.h on systems that lack a working one.
218 stdbool.h: stdbool_.h
219         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
220         mv $@t $@
221
222 BUILT_SOURCES += $(ALLOCA_H)
223 EXTRA_DIST += alloca_.h
224
225 # We need the following in order to create an <alloca.h> when the system
226 # doesn't have one that works with the given compiler.
227 all-local $(lib_OBJECTS): $(ALLOCA_H)
228 alloca.h: alloca_.h
229         cp $(srcdir)/alloca_.h $@-t
230         mv $@-t $@
231 MOSTLYCLEANFILES += alloca.h alloca.h-t
232
233 BUILT_SOURCES += $(FNMATCH_H)
234 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
235
236 # We need the following in order to create an <fnmatch.h> when the system
237 # doesn't have one that supports the required API.
238 all-local $(lib_OBJECTS): $(FNMATCH_H)
239 fnmatch.h: fnmatch_.h
240         cp $(srcdir)/fnmatch_.h $@-t
241         mv $@-t $@
242 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
243
244 BUILT_SOURCES += $(GETOPT_H)
245 EXTRA_DIST += getopt_.h getopt_int.h
246
247 check: unit-test
248
249 .PHONY: unit-test
250 unit-test: t-fpending
251         ./t-fpending > /dev/null
252
253 # We need the following in order to create an <getopt.h> when the system
254 # doesn't have one that works with the given compiler.
255 all-local $(lib_OBJECTS): $(GETOPT_H)
256 getopt.h: getopt_.h
257         cp $(srcdir)/getopt_.h $@-t
258         mv $@-t $@
259 MOSTLYCLEANFILES += getopt.h getopt.h-t