1 ## Makefile for the lib subdirectory of GNU libunistring.
2 ## Copyright (C) 2009-2011 Free Software Foundation, Inc.
4 ## This program is free software: you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 3 of the License, or
7 ## (at your option) any later version.
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ## Process this file with automake to produce Makefile.in.
19 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects no-dependencies
22 MOSTLYCLEANFILES = core *.stackdump
26 MAINTAINERCLEANFILES =
29 lib_LTLIBRARIES = libunistring.la
31 nobase_include_HEADERS = \
51 -I$(top_builddir) -I$(top_srcdir) \
54 # Rules generated and collected by gnulib-tool.
55 include Makefile.gnulib
57 # Additional source files.
58 libunistring_la_SOURCES += version.c
60 # The <stdbool.h> and <stdint.h> replacements that can be installed.
61 nobase_nodist_include_HEADERS = \
65 # Produce an unistring/stdbool.h that is not compiler dependent.
66 # GCC >= 2.95 has <stdbool.h>.
67 # AIX >= 5.3 has <stdbool.h>.
68 # Solaris 10 and some HP-UX 11 versions have <stdbool.h> but it does not
70 unistring/stdbool.h : $(STDBOOL_H) stdbool.mini.h
73 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
74 echo '#if !defined _GL_STDBOOL_H'; \
75 if test -f /usr/include/stdbool.h; then \
76 echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) || defined _AIX'; \
78 echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))'; \
80 echo '#include <stdbool.h>'; \
82 cat $(srcdir)/stdbool.mini.h; \
87 BUILT_SOURCES += unistring/stdbool.h
88 MOSTLYCLEANFILES += unistring/stdbool.h-t
89 CLEANFILES += unistring/stdbool.h
90 EXTRA_DIST += stdbool.mini.h
92 # Produce an unistring/stdint.h that is not compiler dependent.
93 # Glibc >= 2 has <stdint.h>.
94 # On most other platforms that have it, it is buggy in one way or the other.
95 unistring/stdint.h : $(STDINT_H) stdint.mini.h
98 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
99 echo '#include <stddef.h>'; \
100 echo '#if __GLIBC__ >= 2'; \
101 echo '#include <stdint.h>'; \
103 if test -f /usr/include/stdint.h; then \
106 HAVE_STDINT_H='defined __MINGW32__ || defined __HAIKU__'; \
108 if test -f /usr/include/inttypes.h; then \
109 HAVE_INTTYPES_H='1'; \
111 HAVE_INTTYPES_H='defined __MINGW32__ || defined __HAIKU__'; \
113 if test -f /usr/include/sys/inttypes.h; then \
114 HAVE_SYS_INTTYPES_H='1'; \
116 HAVE_SYS_INTTYPES_H='0'; \
118 sed -e 's/@''HAVE_STDINT_H''@/'"$$HAVE_STDINT_H"'/g' \
119 -e 's|@''INCLUDE_NEXT''@|include|g' \
120 -e 's|@''PRAGMA_SYSTEM_HEADER''@||g' \
121 -e 's|@''NEXT_STDINT_H''@|<stdint.h>|g' \
122 -e 's/@''HAVE_SYS_TYPES_H''@/1/g' \
123 -e 's/@''HAVE_INTTYPES_H''@/'"$$HAVE_INTTYPES_H"'/g' \
124 -e 's/@''HAVE_SYS_INTTYPES_H''@/'"$$HAVE_SYS_INTTYPES_H"'/g' \
125 -e 's/@''HAVE_SYS_BITYPES_H''@/0/g' \
126 < $(srcdir)/stdint.mini.h; \
130 BUILT_SOURCES += unistring/stdint.h
131 MOSTLYCLEANFILES += unistring/stdint.h-t
132 CLEANFILES += unistring/stdint.h
133 EXTRA_DIST += stdint.mini.h
135 # localcharset.h is not public, but its contents is documented.
136 nobase_nodist_include_HEADERS += unistring/localcharset.h
137 unistring/localcharset.h : localcharset.h
140 cp $(srcdir)/localcharset.h $@-t
142 BUILT_SOURCES += unistring/localcharset.h
143 MOSTLYCLEANFILES += unistring/localcharset.h-t
144 CLEANFILES += unistring/localcharset.h
146 # iconveh.h is not public, but its contents is documented.
147 nobase_nodist_include_HEADERS += unistring/iconveh.h
148 unistring/iconveh.h : iconveh.h
151 cp $(srcdir)/iconveh.h $@-t
153 BUILT_SOURCES += unistring/iconveh.h
154 MOSTLYCLEANFILES += unistring/iconveh.h-t
155 CLEANFILES += unistring/iconveh.h
157 # unistring/version.h is public.
158 nobase_nodist_include_HEADERS += unistring/version.h
160 # unistring/cdefs.h is not public, but is included by other header files.
161 nobase_nodist_include_HEADERS += unistring/cdefs.h
162 unistring/cdefs.h : unistring/cdefs.in.h $(UNUSED_PARAMETER_H)
165 sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
166 < $(srcdir)/unistring/cdefs.in.h \
169 BUILT_SOURCES += unistring/cdefs.h
170 MOSTLYCLEANFILES += unistring/cdefs.h-t
171 CLEANFILES += unistring/cdefs.h
172 EXTRA_DIST += unistring/cdefs.in.h
174 # unistring/woe32dll.h is not public, but is included by other header files.
175 nobase_nodist_include_HEADERS += unistring/woe32dll.h
177 # Directories that contain some CLEANFILES.
179 CLEANDIRS_NOT_IN_SRCDIR = unistring
180 clean-local: clean-generic
181 @for dir in '' $(CLEANDIRS); do \
182 if test -n "$$dir" && test -d $$dir; then \
183 echo "rmdir $$dir"; rmdir $$dir; \
186 if test '$(srcdir)' != '.'; then \
187 for dir in '' $(CLEANDIRS_NOT_IN_SRCDIR); do \
188 if test -n "$$dir" && test -d $$dir; then \
189 echo "rmdir $$dir"; rmdir $$dir; \
195 # List of header files that get installed and that declare 'extern' symbols.
196 HEADERS_WITH_EXTERNS = \
211 unistring/version.in.h
213 # List of exported symbols.
214 # We extract it from the header files that get installed.
215 # We keep symbols that start with "_UC", because they may be needed for
216 # compiling newer versions of gnulib modules when the gnulib module
217 # 'libunistring-optional' is in use.
218 # This file has the same format as the one expected by the libtool option
219 # '-export-symbols', but we don't use this option, because it would prevent us
220 # from building some of the gnulib unit tests.
221 libunistring.sym : $(HEADERS_WITH_EXTERNS)
222 for f in $(HEADERS_WITH_EXTERNS); do \
223 if test -f $$f; then \
229 | $(srcdir)/declared.sh | LC_ALL=C sort | LC_ALL=C uniq \
232 # We distribute it because declared.sh relies on GNU sed.
233 MOSTLYCLEANFILES += libunistring.sym-t
234 MAINTAINERCLEANFILES += libunistring.sym
235 EXTRA_DIST += libunistring.sym declared.sh
237 # Tell the mingw or Cygwin linker which symbols to export.
239 libunistring_la_SOURCES += ../woe32dll/unistring-exports.c
240 libunistring_la_LDFLAGS += -Wl,--export-all-symbols
243 # Hide undesired symbols that are defined by libunistring_la_SOURCES or
244 # libunistring_la_LIBADD from the global namespace, by prefixing them with
246 all check install: config.h
247 config.h: $(BUILT_SOURCES) libunistring.sym
248 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
249 : "Avoid double inclusion, to avoid a warning about redefinitions."; \
250 echo '#ifndef UNISTRING_CONFIG_H'; \
251 echo '#define UNISTRING_CONFIG_H'; \
253 echo '#include "../config.h"'; \
255 echo '#endif /* UNISTRING_CONFIG_H */'; \
257 if test -n "$(NAMESPACING)" && test -n "$(HAVE_GLOBAL_SYMBOL_PIPE)"; then \
260 for f in $(libunistring_la_SOURCES) $(libunistring_la_LIBADD); do \
263 *.c | *.$(OBJEXT) | *.lo ) \
264 sf=`echo "$$f" | sed -e 's,\\.[^.]*$$,,'`.c; \
265 test -f $$sf || sf=$(srcdir)/$$sf; \
266 of=`echo "$$f" | sed -e 's,^.*/,,' -e 's,\\.[^.]*$$,,'`.$(OBJEXT); \
267 echo "$(COMPILE) -c $$sf" 1>&6; \
268 $(COMPILE) -c $$sf || { rm -f config.h; exit 1; }; \
269 sh ./exported.sh $$of 1>&5; \
270 rm -f $$of `echo "$$of" | sed -e 's,\\.$(OBJEXT)$$,.lo,'`; \
275 | sed -e 's,.* ,,' | LC_ALL=C sort | LC_ALL=C uniq \
277 if test -f libunistring.sym; then \
278 symfile='libunistring.sym'; \
280 symfile='$(srcdir)/libunistring.sym'; \
282 LC_ALL=C join -v 1 - $$symfile; \
284 | sed -e 's,^\(.*\)$$,#define \1 libunistring_\1,' > config.h-t; \
286 if test -f config.h; then \
287 cat config.h-t >> config.h; \
294 MOSTLYCLEANFILES += config.h config.h-t
296 # Version information according to Woe32 conventions.
297 EXTRA_DIST += libunistring.rc
299 WOE32_LIBADD = libunistring.res.lo
300 libunistring.res.lo : $(srcdir)/libunistring.rc
301 $(LIBTOOL) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) `$(SHELL) $(top_srcdir)/build-aux/windres-options --escape $(VERSION)` -i $(srcdir)/libunistring.rc -o libunistring.res.lo --output-format=coff
302 MOSTLYCLEANFILES += libunistring.res.lo
306 libunistring_la_LIBADD += $(WOE32_LIBADD)
307 libunistring_la_DEPENDENCIES += $(WOE32_LIBADD)
309 # Parametrization of the 'relocatable-lib-lgpl' module.
310 AM_CPPFLAGS += -DDEPENDS_ON_LIBICONV=1
312 # Libtool's library version information for libunistring.
313 # See the libtool documentation, section "Library interface versions".
318 # How to build libunistring.la.
319 libunistring_la_LDFLAGS += \
320 -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \