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 = \
34 full-read.c full-read.h \
35 full-write.c full-write.h \
37 localcharset.c localcharset.h \
38 mbswidth.c mbswidth.h \
39 readtokens0.c readtokens0.h \
41 root-dev-ino.c root-dev-ino.h \
43 unicodeio.c unicodeio.h \
44 version-etc.c version-etc.h version-etc-fsf.c \
46 xgethostname.c xgethostname.h \
47 xmemcoll.c xmemcoll.h \
48 xstrndup.c xstrndup.h \
53 libcoreutils_a_SOURCES += \
59 libcoreutils_a_LIBADD = $(LIBOBJS) $(ALLOCA)
60 libcoreutils_a_DEPENDENCIES = $(libcoreutils_a_LIBADD)
62 lib_OBJECTS = $(libcoreutils_a_OBJECTS)
65 BUILT_SOURCES = getdate.c
67 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
71 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
72 getndelim2.c getndelim2.h
74 # We need the following in order to install a simple file in $(libdir)
75 # which is shared with other installed packages. We use a list of referencing
76 # packages so that "make uninstall" will remove the file if and only if it
77 # is not used by another installed package.
78 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
79 # avoid installing it.
81 all-local: charset.alias ref-add.sed ref-del.sed
83 charset_alias = $(DESTDIR)$(libdir)/charset.alias
84 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
85 install-exec-local: all-local
86 test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
87 if test -f $(charset_alias); then \
88 sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
89 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
90 rm -f $(charset_tmp) ; \
92 if test $(GLIBC21) = no; then \
93 sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
94 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
95 rm -f $(charset_tmp) ; \
99 uninstall-local: all-local
100 if test -f $(charset_alias); then \
101 sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
102 if grep '^# Packages using this file: $$' $(charset_tmp) \
104 rm -f $(charset_alias); \
106 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
108 rm -f $(charset_tmp); \
111 charset.alias: config.charset
112 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
115 SUFFIXES += .sed .sin
117 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
120 CLEANFILES += charset.alias ref-add.sed ref-del.sed
122 BUILT_SOURCES += $(STDBOOL_H)
123 EXTRA_DIST += stdbool_.h
124 MOSTLYCLEANFILES += stdbool.h stdbool.ht
125 # Create stdbool.h on systems that lack a working one.
126 stdbool.h: stdbool_.h
127 sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t
130 BUILT_SOURCES += $(ALLOCA_H)
131 EXTRA_DIST += alloca_.h
133 # We need the following in order to create an <alloca.h> when the system
134 # doesn't have one that works with the given compiler.
135 all-local $(lib_OBJECTS): $(ALLOCA_H)
137 cp $(srcdir)/alloca_.h $@-t
139 MOSTLYCLEANFILES += alloca.h alloca.h-t
141 BUILT_SOURCES += $(FNMATCH_H)
142 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
144 # We need the following in order to create an <fnmatch.h> when the system
145 # doesn't have one that supports the required API.
146 all-local $(lib_OBJECTS): $(FNMATCH_H)
147 fnmatch.h: fnmatch_.h
148 cp $(srcdir)/fnmatch_.h $@-t
150 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
152 BUILT_SOURCES += $(GETOPT_H)
153 EXTRA_DIST += getopt_.h getopt_int.h
158 unit-test: t-fpending
159 ./t-fpending > /dev/null
161 # We need the following in order to create an <getopt.h> when the system
162 # doesn't have one that works with the given compiler.
163 all-local $(lib_OBJECTS): $(GETOPT_H)
165 cp $(srcdir)/getopt_.h $@-t
167 MOSTLYCLEANFILES += getopt.h getopt.h-t