1 ## Makefile for gnulib/lib -*-Makefile-*-
3 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
4 # Software Foundation, Inc.
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2, or (at your option)
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, write to the Free Software
18 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 noinst_LIBRARIES = libfetish.a
23 AM_CPPFLAGS = -I.. -I$(srcdir)
24 DEFS += -DLIBDIR=\"$(libdir)\"
26 ## Put relatively complex files at the beginning of the list so
27 ## that parallel compiles finish a tiny bit sooner. I don't see
28 ## a way to make regex.c appear earlier in the list, since it's
29 ## added by automake, but on systems with an up to date GNU libc,
30 ## regex.c isn't even compiled.
31 libfetish_a_SOURCES = \
35 posixver.c posixver.h \
36 strftime.c strftime.h \
37 getopt.c getopt.h getopt1.c \
39 hash-pjw.c hash-pjw.h \
42 argmatch.c argmatch.h \
43 backupfile.c backupfile.h \
47 closeout.c closeout.h \
48 cycle-check.c cycle-check.h \
57 exitfail.c exitfail.h \
58 filemode.c filemode.h \
59 file-type.c file-type.h \
63 full-read.c full-read.h \
64 full-write.c full-write.h \
71 hard-locale.c hard-locale.h \
77 linebuffer.c linebuffer.h \
78 localcharset.c localcharset.h \
79 long-options.c long-options.h \
80 makepath.c makepath.h \
81 mbswidth.c mbswidth.h \
83 memcasecmp.c memcasecmp.h \
85 modechange.c modechange.h \
88 path-concat.c path-concat.h \
92 quotearg.c quotearg.h \
93 readtokens.c readtokens.h \
96 safe-read.c safe-read.h \
97 safe-write.c safe-write.h \
99 save-cwd.c save-cwd.h \
100 savedir.c savedir.h \
112 unicodeio.c unicodeio.h \
116 utimens.c utimens.h \
117 version-etc.c version-etc.h \
119 xgetcwd.c xgetcwd.h \
122 xmemcoll.c xmemcoll.h \
123 xnanosleep.c xnanosleep.h \
124 xreadlink.c xreadlink.h \
126 xstrndup.c xstrndup.h \
127 xstrtod.c xstrtod.h \
128 xstrtol.c xstrtol.h \
133 libfetish_a_SOURCES += \
139 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
140 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
142 lib_OBJECTS = $(libfetish_a_OBJECTS)
145 BUILT_SOURCES = getdate.c
147 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
151 EXTRA_DIST = config.charset ref-add.sin ref-del.sin \
152 getndelim2.c getndelim2.h \
153 inttostr.c inttostr.h
155 # We need the following in order to install a simple file in $(libdir)
156 # which is shared with other installed packages. We use a list of referencing
157 # packages so that "make uninstall" will remove the file if and only if it
158 # is not used by another installed package.
159 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
160 # avoid installing it.
162 all-local: charset.alias ref-add.sed ref-del.sed
164 charset_alias = $(DESTDIR)$(libdir)/charset.alias
165 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
166 install-exec-local: all-local
167 test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
168 if test -f $(charset_alias); then \
169 sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
170 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
171 rm -f $(charset_tmp) ; \
173 if test $(GLIBC21) = no; then \
174 sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
175 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
176 rm -f $(charset_tmp) ; \
180 uninstall-local: all-local
181 if test -f $(charset_alias); then \
182 sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
183 if grep '^# Packages using this file: $$' $(charset_tmp) \
185 rm -f $(charset_alias); \
187 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
189 rm -f $(charset_tmp); \
192 charset.alias: config.charset
193 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
196 SUFFIXES += .sed .sin
198 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
201 CLEANFILES += charset.alias ref-add.sed ref-del.sed
203 BUILT_SOURCES += $(STDBOOL_H)
204 EXTRA_DIST += stdbool_.h
205 MOSTLYCLEANFILES += stdbool.h stdbool.ht
206 # Create stdbool.h on systems that lack a working one.
207 stdbool.h: stdbool_.h
208 sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
211 BUILT_SOURCES += $(ALLOCA_H)
212 EXTRA_DIST += alloca_.h
214 # We need the following in order to create an <alloca.h> when the system
215 # doesn't have one that works with the given compiler.
216 all-local $(lib_OBJECTS): $(ALLOCA_H)
218 cp $(srcdir)/alloca_.h $@-t
220 MOSTLYCLEANFILES += alloca.h alloca.h-t
222 BUILT_SOURCES += $(FNMATCH_H)
223 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
225 # We need the following in order to create an <fnmatch.h> when the system
226 # doesn't have one that supports the required API.
227 all-local $(lib_OBJECTS): $(FNMATCH_H)
228 fnmatch.h: fnmatch_.h
229 cp $(srcdir)/fnmatch_.h $@-t
231 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
233 DISTCLEANFILES = ftw.h search.h