tizen 2.4 release
[external/libunistring.git] / lib / Makefile.am
1 ## Makefile for the lib subdirectory of GNU libunistring.
2 ## Copyright (C) 2009-2011 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
19 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects no-dependencies
20 EXTRA_DIST =
21 BUILT_SOURCES =
22 MOSTLYCLEANFILES = core *.stackdump
23 MOSTLYCLEANDIRS =
24 CLEANFILES =
25 DISTCLEANFILES =
26 MAINTAINERCLEANFILES =
27 SUFFIXES =
28
29 lib_LTLIBRARIES = libunistring.la
30
31 nobase_include_HEADERS = \
32   unitypes.h \
33   unistr.h \
34   uniconv.h \
35   unistdio.h \
36   uniname.h \
37   unictype.h \
38   uniwidth.h \
39   unigbrk.h \
40   uniwbrk.h \
41   unilbrk.h \
42   uninorm.h \
43   unicase.h \
44   unistring/inline.h
45
46 noinst_HEADERS = \
47   unistring-notinline.h
48
49 AM_CPPFLAGS = \
50   -I. -I$(srcdir) \
51   -I$(top_builddir) -I$(top_srcdir) \
52   -DIN_LIBUNISTRING
53
54 # Rules generated and collected by gnulib-tool.
55 include Makefile.gnulib
56
57 # Additional source files.
58 libunistring_la_SOURCES += version.c
59
60 # The <stdbool.h> and <stdint.h> replacements that can be installed.
61 nobase_nodist_include_HEADERS = \
62   unistring/stdbool.h \
63   unistring/stdint.h
64
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
69 # necessarily work.
70 unistring/stdbool.h : $(STDBOOL_H) stdbool.mini.h
71         @MKDIR_P@ unistring
72         rm -f $@-t $@
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'; \
77           else \
78             echo '#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))'; \
79           fi; \
80           echo '#include <stdbool.h>'; \
81           echo '#else'; \
82           cat $(srcdir)/stdbool.mini.h; \
83           echo '#endif'; \
84           echo '#endif'; \
85         } > $@-t
86         mv $@-t $@
87 BUILT_SOURCES    += unistring/stdbool.h
88 MOSTLYCLEANFILES += unistring/stdbool.h-t
89 CLEANFILES       += unistring/stdbool.h
90 EXTRA_DIST       += stdbool.mini.h
91
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
96         @MKDIR_P@ unistring
97         rm -f $@-t $@
98         { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
99           echo '#include <stddef.h>'; \
100           echo '#if __GLIBC__ >= 2'; \
101           echo '#include <stdint.h>'; \
102           echo '#else'; \
103           if test -f /usr/include/stdint.h; then \
104             HAVE_STDINT_H='1'; \
105           else \
106             HAVE_STDINT_H='defined __MINGW32__ || defined __HAIKU__'; \
107           fi; \
108           if test -f /usr/include/inttypes.h; then \
109             HAVE_INTTYPES_H='1'; \
110           else \
111             HAVE_INTTYPES_H='defined __MINGW32__ || defined __HAIKU__'; \
112           fi; \
113           if test -f /usr/include/sys/inttypes.h; then \
114             HAVE_SYS_INTTYPES_H='1'; \
115           else \
116             HAVE_SYS_INTTYPES_H='0'; \
117           fi; \
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; \
127           echo '#endif'; \
128         } > $@-t
129         mv $@-t $@
130 BUILT_SOURCES    += unistring/stdint.h
131 MOSTLYCLEANFILES += unistring/stdint.h-t
132 CLEANFILES       += unistring/stdint.h
133 EXTRA_DIST       += stdint.mini.h
134
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
138         @MKDIR_P@ unistring
139         rm -f $@-t $@
140         cp $(srcdir)/localcharset.h $@-t
141         mv $@-t $@
142 BUILT_SOURCES    += unistring/localcharset.h
143 MOSTLYCLEANFILES += unistring/localcharset.h-t
144 CLEANFILES       += unistring/localcharset.h
145
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
149         @MKDIR_P@ unistring
150         rm -f $@-t $@
151         cp $(srcdir)/iconveh.h $@-t
152         mv $@-t $@
153 BUILT_SOURCES    += unistring/iconveh.h
154 MOSTLYCLEANFILES += unistring/iconveh.h-t
155 CLEANFILES       += unistring/iconveh.h
156
157 # unistring/version.h is public.
158 nobase_nodist_include_HEADERS += unistring/version.h
159
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)
163         @MKDIR_P@ unistring
164         rm -f $@-t $@
165         sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
166             < $(srcdir)/unistring/cdefs.in.h \
167             > $@-t
168         mv $@-t $@
169 BUILT_SOURCES    += unistring/cdefs.h
170 MOSTLYCLEANFILES += unistring/cdefs.h-t
171 CLEANFILES       += unistring/cdefs.h
172 EXTRA_DIST       += unistring/cdefs.in.h
173
174 # unistring/woe32dll.h is not public, but is included by other header files.
175 nobase_nodist_include_HEADERS += unistring/woe32dll.h
176
177 # Directories that contain some CLEANFILES.
178 CLEANDIRS = 
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; \
184           fi; \
185         done; \
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; \
190             fi; \
191           done; \
192         fi; \
193         :
194
195 # List of header files that get installed and that declare 'extern' symbols.
196 HEADERS_WITH_EXTERNS = \
197   unitypes.h \
198   unistr.h \
199   uniconv.h \
200   unistdio.h \
201   uniname.h \
202   unictype.h \
203   uniwidth.h \
204   unigbrk.h \
205   uniwbrk.h \
206   unilbrk.h \
207   uninorm.h \
208   unicase.h \
209   localcharset.h \
210   iconveh.h \
211   unistring/version.in.h
212
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 \
224             cat $$f; \
225           else \
226             cat $(srcdir)/$$f; \
227           fi; \
228         done \
229           | $(srcdir)/declared.sh | LC_ALL=C sort | LC_ALL=C uniq \
230           > $@-t
231         mv $@-t $@
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
236
237 # Tell the mingw or Cygwin linker which symbols to export.
238 if WOE32DLL
239 libunistring_la_SOURCES += ../woe32dll/unistring-exports.c
240 libunistring_la_LDFLAGS += -Wl,--export-all-symbols
241 endif
242
243 # Hide undesired symbols that are defined by libunistring_la_SOURCES or
244 # libunistring_la_LIBADD from the global namespace, by prefixing them with
245 # "libunistring_".
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'; \
252           echo; \
253           echo '#include "../config.h"'; \
254           echo; \
255           echo '#endif /* UNISTRING_CONFIG_H */'; \
256         } > config.h && \
257         if test -n "$(NAMESPACING)" && test -n "$(HAVE_GLOBAL_SYMBOL_PIPE)"; then \
258           { \
259             { \
260               for f in $(libunistring_la_SOURCES) $(libunistring_la_LIBADD); do \
261                 case $$f in \
262                   *.res.lo ) ;; \
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,'`; \
271                     ;; \
272                 esac; \
273               done; \
274             } 5>&1 \
275               | sed -e 's,.* ,,' | LC_ALL=C sort | LC_ALL=C uniq \
276               | { \
277                   if test -f libunistring.sym; then \
278                     symfile='libunistring.sym'; \
279                   else \
280                     symfile='$(srcdir)/libunistring.sym'; \
281                   fi; \
282                   LC_ALL=C join -v 1 - $$symfile; \
283                 } \
284               | sed -e 's,^\(.*\)$$,#define \1 libunistring_\1,' > config.h-t; \
285           } 6>&1 && \
286           if test -f config.h; then \
287             cat config.h-t >> config.h; \
288             rm -f config.h-t; \
289           else \
290             rm -f config.h-t; \
291             exit 1; \
292           fi \
293         fi
294 MOSTLYCLEANFILES += config.h config.h-t
295
296 # Version information according to Woe32 conventions.
297 EXTRA_DIST += libunistring.rc
298 if WOE32
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
303 else
304 WOE32_LIBADD =
305 endif
306 libunistring_la_LIBADD       += $(WOE32_LIBADD)
307 libunistring_la_DEPENDENCIES += $(WOE32_LIBADD)
308
309 # Parametrization of the 'relocatable-lib-lgpl' module.
310 AM_CPPFLAGS += -DDEPENDS_ON_LIBICONV=1
311
312 # Libtool's library version information for libunistring.
313 # See the libtool documentation, section "Library interface versions".
314 LTV_CURRENT=2
315 LTV_REVISION=0
316 LTV_AGE=0
317
318 # How to build libunistring.la.
319 libunistring_la_LDFLAGS += \
320   -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
321   -rpath $(libdir)