(libfetish_a_SOURCES): Remove fts.c, fts_.h, and
[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 libfetish_a_SOURCES = \
29   allocsa.c allocsa.h \
30   argmatch.c argmatch.h \
31   cycle-check.c cycle-check.h \
32   dev-ino.h \
33   diacrit.c diacrit.h \
34   dup-safer.c \
35   euidaccess.h \
36   exit.h \
37   fcntl-safer.h \
38   fopen-safer.c \
39   full-read.c full-read.h \
40   full-write.c full-write.h \
41   gettext.h \
42   imaxtostr.c \
43   linebuffer.c linebuffer.h \
44   localcharset.c localcharset.h \
45   mbswidth.c mbswidth.h \
46   memcasecmp.c memcasecmp.h \
47   offtostr.c \
48   open-safer.c \
49   readtokens0.c readtokens0.h \
50   regex.h \
51   root-dev-ino.c root-dev-ino.h \
52   stat-macros.h \
53   stdio-safer.h \
54   stripslash.c \
55   time_r.c time_r.h \
56   umaxtostr.c \
57   unicodeio.c unicodeio.h \
58   unistd-safer.h \
59   version-etc.c version-etc.h version-etc-fsf.c \
60   xalloc-die.c \
61   xfts.c xfts.h \
62   xgetcwd.c xgetcwd.h \
63   xgethostname.c xgethostname.h \
64   xmemcoll.c xmemcoll.h \
65   xnanosleep.c xnanosleep.h \
66   xreadlink.c xreadlink.h \
67   xstrndup.c xstrndup.h \
68   xstrtod.c xstrtod.h \
69   xstrtoimax.c \
70   xstrtol.c xstrtol.h \
71   xstrtoul.c \
72   xstrtoumax.c
73
74 libfetish_a_SOURCES += \
75   printf-args.h \
76   printf-parse.h \
77   vasprintf.h \
78   vasnprintf.h
79
80 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
81 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
82
83 lib_OBJECTS = $(libfetish_a_OBJECTS)
84
85
86 BUILT_SOURCES = getdate.c
87 CLEANFILES =
88 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
89 MOSTLYCLEANFILES =
90 SUFFIXES =
91
92 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
93   getndelim2.c getndelim2.h \
94   inttostr.c inttostr.h
95
96 # We need the following in order to install a simple file in $(libdir)
97 # which is shared with other installed packages. We use a list of referencing
98 # packages so that "make uninstall" will remove the file if and only if it
99 # is not used by another installed package.
100 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
101 # avoid installing it.
102
103 all-local: charset.alias ref-add.sed ref-del.sed
104
105 charset_alias = $(DESTDIR)$(libdir)/charset.alias
106 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
107 install-exec-local: all-local
108         test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
109         if test -f $(charset_alias); then \
110           sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
111           $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
112           rm -f $(charset_tmp) ; \
113         else \
114           if test $(GLIBC21) = no; then \
115             sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
116             $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
117             rm -f $(charset_tmp) ; \
118           fi ; \
119         fi
120
121 uninstall-local: all-local
122         if test -f $(charset_alias); then \
123           sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
124           if grep '^# Packages using this file: $$' $(charset_tmp) \
125               > /dev/null; then \
126             rm -f $(charset_alias); \
127           else \
128             $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
129           fi; \
130           rm -f $(charset_tmp); \
131         fi
132
133 charset.alias: config.charset
134         $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
135         mv t-$@ $@
136
137 SUFFIXES += .sed .sin
138 .sin.sed:
139         sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
140         mv t-$@ $@
141
142 CLEANFILES += charset.alias ref-add.sed ref-del.sed
143
144 BUILT_SOURCES += $(STDBOOL_H)
145 EXTRA_DIST += stdbool_.h
146 MOSTLYCLEANFILES += stdbool.h stdbool.ht
147 # Create stdbool.h on systems that lack a working one.
148 stdbool.h: stdbool_.h
149         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
150         mv $@t $@
151
152 BUILT_SOURCES += $(ALLOCA_H)
153 EXTRA_DIST += alloca_.h
154
155 # We need the following in order to create an <alloca.h> when the system
156 # doesn't have one that works with the given compiler.
157 all-local $(lib_OBJECTS): $(ALLOCA_H)
158 alloca.h: alloca_.h
159         cp $(srcdir)/alloca_.h $@-t
160         mv $@-t $@
161 MOSTLYCLEANFILES += alloca.h alloca.h-t
162
163 BUILT_SOURCES += $(FNMATCH_H)
164 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
165
166 # We need the following in order to create an <fnmatch.h> when the system
167 # doesn't have one that supports the required API.
168 all-local $(lib_OBJECTS): $(FNMATCH_H)
169 fnmatch.h: fnmatch_.h
170         cp $(srcdir)/fnmatch_.h $@-t
171         mv $@-t $@
172 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
173
174 BUILT_SOURCES += $(GETOPT_H)
175 EXTRA_DIST += getopt_.h getopt_int.h
176
177 check: unit-test
178
179 .PHONY: unit-test
180 unit-test: t-fpending
181         ./t-fpending > /dev/null
182
183 # We need the following in order to create an <getopt.h> when the system
184 # doesn't have one that works with the given compiler.
185 all-local $(lib_OBJECTS): $(GETOPT_H)
186 getopt.h: getopt_.h
187         cp $(srcdir)/getopt_.h $@-t
188         mv $@-t $@
189 MOSTLYCLEANFILES += getopt.h getopt.h-t