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