1 ## Makefile for gnulib/lib -*-Makefile-*-
3 # Copyright (C) 1995-2005 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 libfetish_a_SOURCES = \
30 argmatch.c argmatch.h \
31 cycle-check.c cycle-check.h \
39 full-read.c full-read.h \
40 full-write.c full-write.h \
42 localcharset.c localcharset.h \
43 mbswidth.c mbswidth.h \
45 readtokens0.c readtokens0.h \
47 root-dev-ino.c root-dev-ino.h \
51 unicodeio.c unicodeio.h \
53 version-etc.c version-etc.h version-etc-fsf.c \
57 xgethostname.c xgethostname.h \
58 xmemcoll.c xmemcoll.h \
59 xreadlink.c xreadlink.h \
60 xstrndup.c xstrndup.h \
67 libfetish_a_SOURCES += \
73 libfetish_a_LIBADD = $(LIBOBJS) $(ALLOCA)
74 libfetish_a_DEPENDENCIES = $(libfetish_a_LIBADD)
76 lib_OBJECTS = $(libfetish_a_OBJECTS)
79 BUILT_SOURCES = getdate.c
81 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
85 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
86 getndelim2.c getndelim2.h
88 # We need the following in order to install a simple file in $(libdir)
89 # which is shared with other installed packages. We use a list of referencing
90 # packages so that "make uninstall" will remove the file if and only if it
91 # is not used by another installed package.
92 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
93 # avoid installing it.
95 all-local: charset.alias ref-add.sed ref-del.sed
97 charset_alias = $(DESTDIR)$(libdir)/charset.alias
98 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
99 install-exec-local: all-local
100 test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
101 if test -f $(charset_alias); then \
102 sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
103 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
104 rm -f $(charset_tmp) ; \
106 if test $(GLIBC21) = no; then \
107 sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
108 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
109 rm -f $(charset_tmp) ; \
113 uninstall-local: all-local
114 if test -f $(charset_alias); then \
115 sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
116 if grep '^# Packages using this file: $$' $(charset_tmp) \
118 rm -f $(charset_alias); \
120 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
122 rm -f $(charset_tmp); \
125 charset.alias: config.charset
126 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
129 SUFFIXES += .sed .sin
131 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
134 CLEANFILES += charset.alias ref-add.sed ref-del.sed
136 BUILT_SOURCES += $(STDBOOL_H)
137 EXTRA_DIST += stdbool_.h
138 MOSTLYCLEANFILES += stdbool.h stdbool.ht
139 # Create stdbool.h on systems that lack a working one.
140 stdbool.h: stdbool_.h
141 sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
144 BUILT_SOURCES += $(ALLOCA_H)
145 EXTRA_DIST += alloca_.h
147 # We need the following in order to create an <alloca.h> when the system
148 # doesn't have one that works with the given compiler.
149 all-local $(lib_OBJECTS): $(ALLOCA_H)
151 cp $(srcdir)/alloca_.h $@-t
153 MOSTLYCLEANFILES += alloca.h alloca.h-t
155 BUILT_SOURCES += $(FNMATCH_H)
156 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
158 # We need the following in order to create an <fnmatch.h> when the system
159 # doesn't have one that supports the required API.
160 all-local $(lib_OBJECTS): $(FNMATCH_H)
161 fnmatch.h: fnmatch_.h
162 cp $(srcdir)/fnmatch_.h $@-t
164 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
166 BUILT_SOURCES += $(GETOPT_H)
167 EXTRA_DIST += getopt_.h getopt_int.h
172 unit-test: t-fpending
173 ./t-fpending > /dev/null
175 # We need the following in order to create an <getopt.h> when the system
176 # doesn't have one that works with the given compiler.
177 all-local $(lib_OBJECTS): $(GETOPT_H)
179 cp $(srcdir)/getopt_.h $@-t
181 MOSTLYCLEANFILES += getopt.h getopt.h-t