(libfetish_a_SOURCES): Add cloexec.c, cloexec.h.
[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 \
37   hash.c hash.h \
38   hash-pjw.c hash-pjw.h \
39   __fpending.h \
40   addext.c \
41   argmatch.c argmatch.h \
42   backupfile.c backupfile.h \
43   basename.c \
44   c-strtod.c c-strtod.h \
45   canon-host.c \
46   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   filemode.c filemode.h \
60   file-type.c file-type.h \
61   fopen-safer.c \
62   fsusage.h \
63   fts.c fts_.h \
64   full-read.c full-read.h \
65   full-write.c full-write.h \
66   getline.h \
67   getpagesize.h \
68   gettime.c \
69   gettext.h \
70   getugroups.c \
71   group-member.h \
72   hard-locale.c hard-locale.h \
73   human.c human.h \
74   idcache.c \
75   isdir.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   path-concat.c path-concat.h \
90   pathmax.h \
91   physmem.c physmem.h \
92   quote.c quote.h \
93   quotearg.c quotearg.h \
94   readtokens.c readtokens.h \
95   readutmp.h \
96   regex.h \
97   root-dev-ino.c root-dev-ino.h \
98   safe-read.c safe-read.h \
99   safe-write.c safe-write.h \
100   same.c same.h \
101   save-cwd.c save-cwd.h \
102   savedir.c savedir.h \
103   settime.c \
104   sha1.c sha1.h \
105   sig2str.h \
106   stdio-safer.h \
107   stripslash.c \
108   strndup.h \
109   strverscmp.h \
110   time_r.c time_r.h \
111   timespec.h \
112   umaxtostr.c \
113   unicodeio.c unicodeio.h \
114   unistd-safer.h \
115   unlocked-io.h \
116   userspec.c userspec.h \
117   utimens.c utimens.h \
118   version-etc.c version-etc.h \
119   xalloc.h \
120   xfts.c xfts.h \
121   xgetcwd.c xgetcwd.h \
122   xgethostname.c xgethostname.h \
123   xmalloc.c \
124   xmemcoll.c xmemcoll.h \
125   xnanosleep.c xnanosleep.h \
126   xreadlink.c xreadlink.h \
127   xstrdup.c \
128   xstrndup.c xstrndup.h \
129   xstrtod.c xstrtod.h \
130   xstrtoimax.c \
131   xstrtol.c xstrtol.h \
132   xstrtoul.c \
133   xstrtoumax.c \
134   yesno.c
135
136 libfetish_a_SOURCES += \
137   printf-args.h \
138   printf-parse.h \
139   vasprintf.h \
140   vasnprintf.h
141
142 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
143 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
144
145 lib_OBJECTS = $(libfetish_a_OBJECTS)
146
147
148 BUILT_SOURCES = getdate.c
149 CLEANFILES =
150 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
151 MOSTLYCLEANFILES =
152 SUFFIXES =
153
154 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
155   getndelim2.c getndelim2.h \
156   inttostr.c inttostr.h
157
158 # We need the following in order to install a simple file in $(libdir)
159 # which is shared with other installed packages. We use a list of referencing
160 # packages so that "make uninstall" will remove the file if and only if it
161 # is not used by another installed package.
162 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
163 # avoid installing it.
164
165 all-local: charset.alias ref-add.sed ref-del.sed
166
167 charset_alias = $(DESTDIR)$(libdir)/charset.alias
168 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
169 install-exec-local: all-local
170         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
171         if test -f $(charset_alias); then \
172           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
173           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
174           rm -f $(charset_tmp) ; \
175         else \
176           if test $(GLIBC21) = no; then \
177             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
178             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
179             rm -f $(charset_tmp) ; \
180           fi ; \
181         fi
182
183 uninstall-local: all-local
184         if test -f $(charset_alias); then \
185           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
186           if grep '^# Packages using this file: $$' $(charset_tmp) \
187               > /dev/null; then \
188             rm -f $(charset_alias); \
189           else \
190             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
191           fi; \
192           rm -f $(charset_tmp); \
193         fi
194
195 charset.alias: config.charset
196         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
197         mv t-$@ $@
198
199 SUFFIXES += .sed .sin
200 .sin.sed:
201         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
202         mv t-$@ $@
203
204 CLEANFILES += charset.alias ref-add.sed ref-del.sed
205
206 BUILT_SOURCES += $(STDBOOL_H)
207 EXTRA_DIST += stdbool_.h
208 MOSTLYCLEANFILES += stdbool.h stdbool.ht
209 # Create stdbool.h on systems that lack a working one.
210 stdbool.h: stdbool_.h
211         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
212         mv $@t $@
213
214 BUILT_SOURCES += $(ALLOCA_H)
215 EXTRA_DIST += alloca_.h
216
217 # We need the following in order to create an <alloca.h> when the system
218 # doesn't have one that works with the given compiler.
219 all-local $(lib_OBJECTS): $(ALLOCA_H)
220 alloca.h: alloca_.h
221         cp $(srcdir)/alloca_.h $@-t
222         mv $@-t $@
223 MOSTLYCLEANFILES += alloca.h alloca.h-t
224
225 BUILT_SOURCES += $(FNMATCH_H)
226 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
227
228 # We need the following in order to create an <fnmatch.h> when the system
229 # doesn't have one that supports the required API.
230 all-local $(lib_OBJECTS): $(FNMATCH_H)
231 fnmatch.h: fnmatch_.h
232         cp $(srcdir)/fnmatch_.h $@-t
233         mv $@-t $@
234 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t