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