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., 51 Franklin Street, Fifth Floor, Boston, MA
20 noinst_LIBRARIES = libcoreutils.a
22 noinst_PROGRAMS = t-fpending
23 LDADD = $(noinst_LIBRARIES)
25 AM_CPPFLAGS = -I.. -I$(srcdir)
26 DEFS += -DLIBDIR=\"$(libdir)\"
28 libcoreutils_a_SOURCES = \
33 full-read.c full-read.h \
34 full-write.c full-write.h \
36 localcharset.c localcharset.h \
37 mbswidth.c mbswidth.h \
38 readtokens0.c readtokens0.h \
41 unicodeio.c unicodeio.h \
43 xgethostname.c xgethostname.h \
44 xmemcoll.c xmemcoll.h \
45 xstrndup.c xstrndup.h \
49 libcoreutils_a_SOURCES += \
55 libcoreutils_a_LIBADD = $(LIBOBJS) $(ALLOCA)
56 libcoreutils_a_DEPENDENCIES = $(libcoreutils_a_LIBADD)
58 lib_OBJECTS = $(libcoreutils_a_OBJECTS)
61 BUILT_SOURCES = getdate.c
63 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
67 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
68 getndelim2.c getndelim2.h
70 # We need the following in order to install a simple file in $(libdir)
71 # which is shared with other installed packages. We use a list of referencing
72 # packages so that "make uninstall" will remove the file if and only if it
73 # is not used by another installed package.
74 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
75 # avoid installing it.
77 all-local: charset.alias ref-add.sed ref-del.sed
79 charset_alias = $(DESTDIR)$(libdir)/charset.alias
80 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
81 install-exec-local: all-local
82 test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
83 if test -f $(charset_alias); then \
84 sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
85 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
86 rm -f $(charset_tmp) ; \
88 if test $(GLIBC21) = no; then \
89 sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
90 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
91 rm -f $(charset_tmp) ; \
95 uninstall-local: all-local
96 if test -f $(charset_alias); then \
97 sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
98 if grep '^# Packages using this file: $$' $(charset_tmp) \
100 rm -f $(charset_alias); \
102 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
104 rm -f $(charset_tmp); \
107 charset.alias: config.charset
108 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
111 SUFFIXES += .sed .sin
113 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
116 CLEANFILES += charset.alias ref-add.sed ref-del.sed
118 BUILT_SOURCES += $(STDBOOL_H)
119 EXTRA_DIST += stdbool_.h
120 MOSTLYCLEANFILES += stdbool.h stdbool.ht
121 # Create stdbool.h on systems that lack a working one.
122 stdbool.h: stdbool_.h
123 sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
126 BUILT_SOURCES += $(ALLOCA_H)
127 EXTRA_DIST += alloca_.h
129 # We need the following in order to create an <alloca.h> when the system
130 # doesn't have one that works with the given compiler.
131 all-local $(lib_OBJECTS): $(ALLOCA_H)
133 cp $(srcdir)/alloca_.h $@-t
135 MOSTLYCLEANFILES += alloca.h alloca.h-t
137 BUILT_SOURCES += $(FNMATCH_H)
138 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
140 # We need the following in order to create an <fnmatch.h> when the system
141 # doesn't have one that supports the required API.
142 all-local $(lib_OBJECTS): $(FNMATCH_H)
143 fnmatch.h: fnmatch_.h
144 cp $(srcdir)/fnmatch_.h $@-t
146 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
148 BUILT_SOURCES += $(GETOPT_H)
149 EXTRA_DIST += getopt_.h getopt_int.h
154 unit-test: t-fpending
155 ./t-fpending > /dev/null
157 # We need the following in order to create an <getopt.h> when the system
158 # doesn't have one that works with the given compiler.
159 all-local $(lib_OBJECTS): $(GETOPT_H)
161 cp $(srcdir)/getopt_.h $@-t
163 MOSTLYCLEANFILES += getopt.h getopt.h-t