1 ## Makefile for gnulib/lib -*-Makefile-*-
3 # Copyright (C) 1995-2006 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 AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
22 noinst_LIBRARIES = libcoreutils.a
24 noinst_PROGRAMS = t-fpending
25 LDADD = $(noinst_LIBRARIES)
27 AM_CPPFLAGS = -I.. -I$(srcdir)
28 DEFS += -DLIBDIR=\"$(libdir)\"
30 libcoreutils_a_SOURCES = \
33 buffer-lcm.c buffer-lcm.h \
36 full-read.c full-read.h \
37 full-write.c full-write.h \
40 localcharset.c localcharset.h \
42 mbswidth.c mbswidth.h \
44 readtokens0.c readtokens0.h \
46 strnlen1.c strnlen1.h \
48 unicodeio.c unicodeio.h \
51 xgethostname.c xgethostname.h \
52 xmemcoll.c xmemcoll.h \
53 xstrndup.c xstrndup.h \
57 libcoreutils_a_SOURCES += \
63 libcoreutils_a_LIBADD = $(LIBOBJS) $(ALLOCA)
65 lib_OBJECTS = $(libcoreutils_a_OBJECTS)
68 BUILT_SOURCES = getdate.c
70 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
74 EXTRA_DIST = getdate.c config.charset ref-add.sin ref-del.sin \
75 getndelim2.c getndelim2.h
77 # We need the following in order to install a simple file in $(libdir)
78 # which is shared with other installed packages. We use a list of referencing
79 # packages so that "make uninstall" will remove the file if and only if it
80 # is not used by another installed package.
81 # On systems with glibc-2.1 or newer, the file is redundant, therefore we
82 # avoid installing it.
84 all-local: charset.alias ref-add.sed ref-del.sed
86 charset_alias = $(DESTDIR)$(libdir)/charset.alias
87 charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
88 install-exec-local: all-local
89 test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir)
90 if test -f $(charset_alias); then \
91 sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \
92 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
93 rm -f $(charset_tmp) ; \
95 if test $(GLIBC21) = no; then \
96 sed -f ref-add.sed charset.alias > $(charset_tmp) ; \
97 $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \
98 rm -f $(charset_tmp) ; \
102 uninstall-local: all-local
103 if test -f $(charset_alias); then \
104 sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \
105 if grep '^# Packages using this file: $$' $(charset_tmp) \
107 rm -f $(charset_alias); \
109 $(INSTALL_DATA) $(charset_tmp) $(charset_alias); \
111 rm -f $(charset_tmp); \
114 charset.alias: config.charset
115 $(SHELL) $(srcdir)/config.charset '$(host)' > t-$@
118 SUFFIXES += .sed .sin
120 sed -e '/^#/d' -e 's/@''PACKAGE''@/$(PACKAGE)/g' $< > t-$@
123 CLEANFILES += charset.alias ref-add.sed ref-del.sed
125 BUILT_SOURCES += $(STDBOOL_H)
126 EXTRA_DIST += stdbool_.h
127 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
128 # Create stdbool.h on systems that lack a working one.
129 stdbool.h: stdbool_.h
130 sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t
133 BUILT_SOURCES += $(STDINT_H)
134 EXTRA_DIST += stdint_.h
136 # We need the following in order to create <stdint.h> when the system
137 # doesn't have one that works with the given compiler.
139 sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
140 -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
141 -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
142 -e 's|@''FULL_PATH_STDINT_H''@|$(FULL_PATH_STDINT_H)|g' \
143 -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
144 -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
145 -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
146 -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
147 -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \
148 -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \
149 -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \
150 -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \
151 -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \
152 -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \
153 -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \
154 -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \
155 -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \
156 -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \
157 -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
158 -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
159 -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
160 < $(srcdir)/stdint_.h > $@-t
162 MOSTLYCLEANFILES += stdint.h stdint.h-t
164 BUILT_SOURCES += $(ALLOCA_H)
165 EXTRA_DIST += alloca_.h
167 # We need the following in order to create an <alloca.h> when the system
168 # doesn't have one that works with the given compiler.
169 all-local $(lib_OBJECTS): $(ALLOCA_H)
171 cp $(srcdir)/alloca_.h $@-t
173 MOSTLYCLEANFILES += alloca.h alloca.h-t
175 BUILT_SOURCES += $(FNMATCH_H)
176 EXTRA_DIST += fnmatch_.h fnmatch_loop.c
178 # We need the following in order to create an <fnmatch.h> when the system
179 # doesn't have one that supports the required API.
180 all-local $(lib_OBJECTS): $(FNMATCH_H)
181 fnmatch.h: fnmatch_.h
182 cp $(srcdir)/fnmatch_.h $@-t
184 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
186 BUILT_SOURCES += $(GETOPT_H)
187 EXTRA_DIST += getopt_.h getopt_int.h
192 unit-test: t-fpending
193 ./t-fpending > /dev/null
195 # We need the following in order to create an <getopt.h> when the system
196 # doesn't have one that works with the given compiler.
197 all-local $(lib_OBJECTS): $(GETOPT_H)
199 cp $(srcdir)/getopt_.h $@-t
201 MOSTLYCLEANFILES += getopt.h getopt.h-t