1 ## Makefile for gnulib/lib -*-Makefile-*-
3 # Copyright (C) 1995-2004 Free Software Foundation, Inc.
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)
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.
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
20 noinst_LIBRARIES = libfetish.a
22 noinst_PROGRAMS = t-fpending
23 LDADD = $(noinst_LIBRARIES)
25 AM_CPPFLAGS = -I.. -I$(srcdir)
26 DEFS += -DLIBDIR=\"$(libdir)\"
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 = \
37 posixver.c posixver.h \
38 strftime.c strftime.h \
40 hash-pjw.c hash-pjw.h \
43 argmatch.c argmatch.h \
44 backupfile.c backupfile.h \
46 c-strtod.c c-strtod.h c-strtold.c \
48 canonicalize.c canonicalize.h \
49 chdir-long.c chdir-long.h \
51 closeout.c closeout.h \
52 cycle-check.c cycle-check.h \
61 exitfail.c exitfail.h \
63 filemode.c filemode.h \
64 file-type.c file-type.h \
68 full-read.c full-read.h \
69 full-write.c full-write.h \
78 hard-locale.c hard-locale.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 \
89 memcasecmp.c memcasecmp.h \
92 modechange.c modechange.h \
97 path-concat.c path-concat.h \
101 quotearg.c quotearg.h \
102 readtokens0.c readtokens0.h \
103 readtokens.c readtokens.h \
106 root-dev-ino.c root-dev-ino.h \
107 safe-read.c safe-read.h \
108 safe-write.c safe-write.h \
110 save-cwd.c save-cwd.h \
111 savedir.c savedir.h \
125 unicodeio.c unicodeio.h \
128 userspec.c userspec.h \
129 utimecmp.c utimecmp.h \
130 utimens.c utimens.h \
131 version-etc.c version-etc.h \
135 xgetcwd.c xgetcwd.h \
136 xgethostname.c xgethostname.h \
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 \
144 xstrtol.c xstrtol.h \
149 libfetish_a_SOURCES += \
155 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
156 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
158 lib_OBJECTS = $(libfetish_a_OBJECTS)
161 BUILT_SOURCES = getdate.c
163 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
167 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
168 getndelim2.c getndelim2.h \
169 inttostr.c inttostr.h
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.
178 all-local: charset.alias ref-add.sed ref-del.sed
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) ; \
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) ; \
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) \
201 rm -f $(charset_alias); \
203 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
205 rm -f $(charset_tmp); \
208 charset.alias: config.charset
209 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
212 SUFFIXES += .sed .sin
214 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
217 CLEANFILES += charset.alias ref-add.sed ref-del.sed
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
227 BUILT_SOURCES += $(ALLOCA_H)
228 EXTRA_DIST += alloca_.h
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)
234 cp $(srcdir)/alloca_.h $@-t
236 MOSTLYCLEANFILES += alloca.h alloca.h-t
238 BUILT_SOURCES += $(FNMATCH_H)
239 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
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
247 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
249 BUILT_SOURCES += $(GETOPT_H)
250 EXTRA_DIST += getopt_.h getopt_int.h
255 ./t-fpending > /dev/null
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)
261 cp $(srcdir)/getopt_.h $@-t
263 MOSTLYCLEANFILES += getopt.h getopt.h-t