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