1## Makefile for the lib subdirectory of GNU libunistring. 2## Copyright (C) 2009-2010 Free Software Foundation, Inc. 3## 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. 8## 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. 13## 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/>. 16 17## Process this file with automake to produce Makefile.in. 18 19AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects no-dependencies 20EXTRA_DIST = 21BUILT_SOURCES = 22MOSTLYCLEANFILES = core *.stackdump 23CLEANFILES = 24DISTCLEANFILES = 25MAINTAINERCLEANFILES = 26SUFFIXES = 27 28lib_LTLIBRARIES = libunistring.la 29 30nobase_include_HEADERS = \ 31 unitypes.h \ 32 unistr.h \ 33 uniconv.h \ 34 unistdio.h \ 35 uniname.h \ 36 unictype.h \ 37 uniwidth.h \ 38 uniwbrk.h \ 39 unilbrk.h \ 40 uninorm.h \ 41 unicase.h \ 42 unistring/inline.h 43 44noinst_HEADERS = \ 45 unistring-notinline.h 46 47AM_CPPFLAGS = \ 48 -I. -I$(srcdir) \ 49 -I$(top_builddir) -I$(top_srcdir) \ 50 -DIN_LIBUNISTRING 51 52# Rules generated and collected by gnulib-tool. 53include Makefile.gnulib 54 55# Additional source files. 56libunistring_la_SOURCES += version.c 57 58# The <stdbool.h> and <stdint.h> replacements that can be installed. 59nobase_nodist_include_HEADERS = \ 60 unistring/stdbool.h \ 61 unistring/stdint.h 62 63# Produce an unistring/stdbool.h that is not compiler dependent. 64# GCC >= 2.95 has <stdbool.h>. 65# AIX >= 5.3 has <stdbool.h>. 66# Solaris 10 and some HP-UX 11 versions have <stdbool.h> but it does not 67# necessarily work. 68unistring/stdbool.h : $(STDBOOL_H) stdbool.mini.h 69 @MKDIR_P@ unistring 70 rm -f $@-t $@ 71 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ 72 echo '#if !defined _GL_STDBOOL_H'; \ 73 if test -f /usr/include/stdbool.h; then \ 74 echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) || defined _AIX'; \ 75 else \ 76 echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))'; \ 77 fi; \ 78 echo '#include <stdbool.h>'; \ 79 echo '#else'; \ 80 cat $(srcdir)/stdbool.mini.h; \ 81 echo '#endif'; \ 82 echo '#endif'; \ 83 } > $@-t 84 mv $@-t $@ 85BUILT_SOURCES += unistring/stdbool.h 86MOSTLYCLEANFILES += unistring/stdbool.h-t 87CLEANFILES += unistring/stdbool.h 88EXTRA_DIST += stdbool.mini.h 89 90# Produce an unistring/stdint.h that is not compiler dependent. 91# Glibc >= 2 has <stdint.h>. 92# On most other platforms that have it, it is buggy in one way or the other. 93unistring/stdint.h : $(STDINT_H) stdint.mini.h 94 @MKDIR_P@ unistring 95 rm -f $@-t $@ 96 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ 97 echo '#include <stddef.h>'; \ 98 echo '#if __GLIBC__ >= 2'; \ 99 echo '#include <stdint.h>'; \ 100 echo '#else'; \ 101 if test -f /usr/include/stdint.h; then \ 102 HAVE_STDINT_H='1'; \ 103 else \ 104 HAVE_STDINT_H='defined __MINGW32__ || defined __HAIKU__'; \ 105 fi; \ 106 if test -f /usr/include/inttypes.h; then \ 107 HAVE_INTTYPES_H='1'; \ 108 else \ 109 HAVE_INTTYPES_H='defined __MINGW32__ || defined __HAIKU__'; \ 110 fi; \ 111 if test -f /usr/include/sys/inttypes.h; then \ 112 HAVE_SYS_INTTYPES_H='1'; \ 113 else \ 114 HAVE_SYS_INTTYPES_H='0'; \ 115 fi; \ 116 sed -e 's/@''HAVE_STDINT_H''@/'"$$HAVE_STDINT_H"'/g' \ 117 -e 's|@''INCLUDE_NEXT''@|include|g' \ 118 -e 's|@''PRAGMA_SYSTEM_HEADER''@||g' \ 119 -e 's|@''NEXT_STDINT_H''@|<stdint.h>|g' \ 120 -e 's/@''HAVE_SYS_TYPES_H''@/1/g' \ 121 -e 's/@''HAVE_INTTYPES_H''@/'"$$HAVE_INTTYPES_H"'/g' \ 122 -e 's/@''HAVE_SYS_INTTYPES_H''@/'"$$HAVE_SYS_INTTYPES_H"'/g' \ 123 -e 's/@''HAVE_SYS_BITYPES_H''@/0/g' \ 124 < $(srcdir)/stdint.mini.h; \ 125 echo '#endif'; \ 126 } > $@-t 127 mv $@-t $@ 128BUILT_SOURCES += unistring/stdint.h 129MOSTLYCLEANFILES += unistring/stdint.h-t 130CLEANFILES += unistring/stdint.h 131EXTRA_DIST += stdint.mini.h 132 133# localcharset.h is not public, but its contents is documented. 134nobase_nodist_include_HEADERS += unistring/localcharset.h 135unistring/localcharset.h : localcharset.h 136 @MKDIR_P@ unistring 137 rm -f $@-t $@ 138 cp $(srcdir)/localcharset.h $@-t 139 mv $@-t $@ 140BUILT_SOURCES += unistring/localcharset.h 141MOSTLYCLEANFILES += unistring/localcharset.h-t 142CLEANFILES += unistring/localcharset.h 143 144# iconveh.h is not public, but its contents is documented. 145nobase_nodist_include_HEADERS += unistring/iconveh.h 146unistring/iconveh.h : iconveh.h 147 @MKDIR_P@ unistring 148 rm -f $@-t $@ 149 cp $(srcdir)/iconveh.h $@-t 150 mv $@-t $@ 151BUILT_SOURCES += unistring/iconveh.h 152MOSTLYCLEANFILES += unistring/iconveh.h-t 153CLEANFILES += unistring/iconveh.h 154 155# unistring/version.h is public. 156nobase_nodist_include_HEADERS += unistring/version.h 157 158# unistring/cdefs.h is not public, but is included by other header files. 159nobase_nodist_include_HEADERS += unistring/cdefs.h 160unistring/cdefs.h : unistring/cdefs.in.h 161 @MKDIR_P@ unistring 162 rm -f $@-t $@ 163 sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \ 164 < $(srcdir)/unistring/cdefs.in.h \ 165 > $@-t 166 mv $@-t $@ 167BUILT_SOURCES += unistring/cdefs.h 168MOSTLYCLEANFILES += unistring/cdefs.h-t 169CLEANFILES += unistring/cdefs.h 170EXTRA_DIST += unistring/cdefs.in.h 171 172# unistring/woe32dll.h is not public, but is included by other header files. 173nobase_nodist_include_HEADERS += unistring/woe32dll.h 174 175# Directories that contain some CLEANFILES. 176CLEANDIRS = 177CLEANDIRS_NOT_IN_SRCDIR = unistring 178clean-local: clean-generic 179 @for dir in '' $(CLEANDIRS); do \ 180 if test -n "$$dir" && test -d $$dir; then \ 181 echo "rmdir $$dir"; rmdir $$dir; \ 182 fi; \ 183 done; \ 184 if test '$(srcdir)' != '.'; then \ 185 for dir in '' $(CLEANDIRS_NOT_IN_SRCDIR); do \ 186 if test -n "$$dir" && test -d $$dir; then \ 187 echo "rmdir $$dir"; rmdir $$dir; \ 188 fi; \ 189 done; \ 190 fi; \ 191 : 192 193# List of header files that get installed and that declare 'extern' symbols. 194HEADERS_WITH_EXTERNS = \ 195 unitypes.h \ 196 unistr.h \ 197 uniconv.h \ 198 unistdio.h \ 199 uniname.h \ 200 unictype.h \ 201 uniwidth.h \ 202 uniwbrk.h \ 203 unilbrk.h \ 204 uninorm.h \ 205 unicase.h \ 206 localcharset.h \ 207 iconveh.h \ 208 unistring/version.in.h 209 210# List of exported symbols. 211# We extract it from the header files that get installed, removing symbols 212# start with "_UC". 213# This file has the same format as the one expected by the libtool option 214# '-export-symbols', but we don't use this option, because it would prevent us 215# from building some of the gnulib unit tests. 216libunistring.sym : $(HEADERS_WITH_EXTERNS) 217 for f in $(HEADERS_WITH_EXTERNS); do cat $(srcdir)/$$f; done \ 218 | $(srcdir)/declared.sh | LC_ALL=C sort | LC_ALL=C uniq \ 219 | grep -v '^_UC' \ 220 > $@-t 221 mv $@-t $@ 222# We distribute it because declared.sh relies on GNU sed. 223MOSTLYCLEANFILES += libunistring.sym-t 224MAINTAINERCLEANFILES += libunistring.sym 225EXTRA_DIST += libunistring.sym declared.sh 226 227# Tell the mingw or Cygwin linker which symbols to export. 228if WOE32DLL 229libunistring_la_SOURCES += ../woe32dll/unistring-exports.c 230libunistring_la_LDFLAGS += -Wl,--export-all-symbols 231endif 232 233# Hide undesired symbols that are defined by libunistring_la_SOURCES or 234# libunistring_la_LIBADD from the global namespace, by prefixing them with 235# "libunistring_". 236all check install: config.h 237config.h: $(BUILT_SOURCES) libunistring.sym 238 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ 239 : "Avoid double inclusion, to avoid a warning about redefinitions."; \ 240 echo '#ifndef UNISTRING_CONFIG_H'; \ 241 echo '#define UNISTRING_CONFIG_H'; \ 242 echo; \ 243 echo '#include "../config.h"'; \ 244 echo; \ 245 echo '#endif /* UNISTRING_CONFIG_H */'; \ 246 } > config.h && \ 247 if test -n "$(NAMESPACING)" && test -n "$(HAVE_GLOBAL_SYMBOL_PIPE)"; then \ 248 { \ 249 { \ 250 for f in $(libunistring_la_SOURCES) $(libunistring_la_LIBADD); do \ 251 case $$f in \ 252 *.res.lo ) ;; \ 253 *.c | *.$(OBJEXT) | *.lo ) \ 254 sf=`echo "$$f" | sed -e 's,\\.[^.]*$$,,'`.c; \ 255 test -f $$sf || sf=$(srcdir)/$$sf; \ 256 of=`echo "$$f" | sed -e 's,^.*/,,' -e 's,\\.[^.]*$$,,'`.$(OBJEXT); \ 257 echo "$(COMPILE) -c $$sf" 1>&6; \ 258 $(COMPILE) -c $$sf || { rm -f config.h; exit 1; }; \ 259 sh ./exported.sh $$of 1>&5; \ 260 rm -f $$of `echo "$$of" | sed -e 's,\\.$(OBJEXT)$$,.lo,'`; \ 261 ;; \ 262 esac; \ 263 done; \ 264 } 5>&1 \ 265 | sed -e 's,.* ,,' | LC_ALL=C sort | LC_ALL=C uniq \ 266 | { \ 267 if test -f libunistring.sym; then \ 268 symfile='libunistring.sym'; \ 269 else \ 270 symfile='$(srcdir)/libunistring.sym'; \ 271 fi; \ 272 LC_ALL=C join -v 1 - $$symfile; \ 273 } \ 274 | sed -e 's,^\(.*\)$$,#define \1 libunistring_\1,' > config.h-t; \ 275 } 6>&1 && \ 276 if test -f config.h; then \ 277 cat config.h-t >> config.h; \ 278 rm -f config.h-t; \ 279 else \ 280 rm -f config.h-t; \ 281 exit 1; \ 282 fi \ 283 fi 284MOSTLYCLEANFILES += config.h config.h-t 285 286# Version information according to Woe32 conventions. 287EXTRA_DIST += libunistring.rc 288if WOE32 289WOE32_LIBADD = libunistring.res.lo 290libunistring.res.lo : $(srcdir)/libunistring.rc 291 $(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 292MOSTLYCLEANFILES += libunistring.res.lo 293else 294WOE32_LIBADD = 295endif 296libunistring_la_LIBADD += $(WOE32_LIBADD) 297libunistring_la_DEPENDENCIES += $(WOE32_LIBADD) 298 299# Parametrization of the 'relocatable-lib-lgpl' module. 300AM_CPPFLAGS += -DDEPENDS_ON_LIBICONV=1 301 302# Libtool's library version information for libunistring. 303# See the libtool documentation, section "Library interface versions". 304LTV_CURRENT=1 305LTV_REVISION=2 306LTV_AGE=1 307 308# How to build libunistring.la. 309libunistring_la_LDFLAGS += \ 310 -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ 311 -rpath $(libdir) \ 312 @INTL_MACOSX_LIBS@ -no-undefined 313