1 ## Makefile for the gettext-runtime/libasprintf subdirectory of GNU gettext
2 ## Copyright (C) 2002-2005 Free Software Foundation, Inc.
4 ## This program is free software; you can redistribute it and/or modify it
5 ## under the terms of the GNU Library General Public License as published
6 ## by the Free Software Foundation; either version 2, or (at your option)
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 GNU
12 ## Library General Public License for more details.
14 ## You should have received a copy of the GNU Library General Public
15 ## License along with this program; if not, write to the Free Software
16 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 ## Process this file with automake to produce Makefile.in.
21 AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
22 ACLOCAL_AMFLAGS = -I ../../m4 -I ../m4
29 # Library include file.
31 include_HEADERS = autosprintf.h
33 all-local $(libasprintf_la_OBJECTS): autosprintf.h
34 autosprintf.h: autosprintf.h.in
35 cp $(srcdir)/autosprintf.h.in autosprintf.h
36 MOSTLYCLEANFILES += autosprintf.h
37 EXTRA_DIST += autosprintf.h.in
40 rm -f $(distdir)/autosprintf.h
45 lib_LTLIBRARIES = libasprintf.la
47 libasprintf_la_SOURCES = \
48 lib-asprintf.h lib-asprintf.c \
49 autosprintf.h autosprintf.cc
51 # Sources used only on platforms lacking vasprintf().
52 lib_asprintf_EXTRASOURCES = \
54 printf-args.h printf-args.c \
55 printf-parse.h printf-parse.c \
56 vasnprintf.h vasnprintf.c asnprintf.c \
57 vasprintf.h vasprintf.c asprintf.c
58 lib-asprintf.lo: $(lib_asprintf_EXTRASOURCES)
59 EXTRA_DIST += $(lib_asprintf_EXTRASOURCES)
62 # How to build libasprintf.
63 # With libtool 1.5.14, on some platforms, like BeOS, "libtool --tag=CXX" fails
64 # to create a shared library, however "libtool --tag=CC" succeeds.
65 libasprintf.la: $(libasprintf_la_OBJECTS) $(libasprintf_la_DEPENDENCIES)
66 $(CXXLINK) -rpath $(libdir) $(libasprintf_la_LDFLAGS) $(libasprintf_la_OBJECTS) $(libasprintf_la_LIBADD) $(LIBS) || \
67 $(LINK) -rpath $(libdir) $(libasprintf_la_LDFLAGS) $(libasprintf_la_OBJECTS) $(libasprintf_la_LIBADD) $(LIBS)
70 # >>> gnulib module alloca.
71 EXTRA_DIST += alloca_.h
73 # The following is needed in order to create an <alloca.h> when the system
74 # doesn't have one that works with the given compiler.
75 all-local $(libasprintf_la_OBJECTS): @ALLOCA_H@
77 cp $(srcdir)/alloca_.h alloca.h
78 MOSTLYCLEANFILES += alloca.h
79 # <<< gnulib module alloca.
82 # Clean up after Solaris cc.
89 docdir = $(datadir)/doc/@PACKAGE@
95 MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
96 MAKEINFOFLAGS = --no-split
98 info_TEXINFOS = autosprintf.texi
100 # We distribute only the HTML documentation.
101 # The user can generate the others, via
102 # make autosprintf.ps
103 # make autosprintf.pdf
105 all-local: html-local
106 install-data-local: install-html
107 installdirs-local: installdirs-html
108 uninstall-local: uninstall-html
110 CLEANFILES = autosprintf.pdf
111 # autosprintf.dvi and autosprintf.ps are already known to automake.
114 # Documentation in DVI format.
116 install-dvi: autosprintf.dvi
117 $(mkinstalldirs) $(DESTDIR)$(dvidir)
118 $(INSTALL_DATA) `if test -f autosprintf.dvi; then echo .; else echo $(srcdir); fi`/autosprintf.dvi $(DESTDIR)$(dvidir)/autosprintf.dvi
121 $(mkinstalldirs) $(DESTDIR)$(dvidir)
124 $(RM) $(DESTDIR)$(dvidir)/autosprintf.dvi
126 # Temporary index files. automake removes only the predefined ones by itself.
130 # Documentation in Postscript format.
132 # Override of automake's definition:
134 DVIPS = @DVIPS@ -D600
136 autosprintf.ps: autosprintf.dvi
137 $(DVIPS) -o $@ `if test -f autosprintf.dvi; then echo autosprintf.dvi; else echo $(srcdir)/autosprintf.dvi; fi`
139 install-ps: autosprintf.ps
140 $(mkinstalldirs) $(DESTDIR)$(psdir)
141 $(INSTALL_DATA) `if test -f autosprintf.ps; then echo .; else echo $(srcdir); fi`/autosprintf.ps $(DESTDIR)$(psdir)/autosprintf.ps
144 $(mkinstalldirs) $(DESTDIR)$(psdir)
147 $(RM) $(DESTDIR)$(psdir)/autosprintf.ps
150 # Documentation in Portable Document Format.
154 install-pdf: autosprintf.pdf
155 $(mkinstalldirs) $(DESTDIR)$(pdfdir)
156 $(INSTALL_DATA) `if test -f autosprintf.pdf; then echo .; else echo $(srcdir); fi`/autosprintf.pdf $(DESTDIR)$(pdfdir)/autosprintf.pdf
159 $(mkinstalldirs) $(DESTDIR)$(pdfdir)
162 $(RM) $(DESTDIR)$(pdfdir)/autosprintf.pdf
165 # Documentation in HTML format.
167 TEXI2HTML = @PERL@ $(srcdir)/texi2html
169 html-local: autosprintf_all.html
171 # Override of automake's definition.
172 # We want to use texi2html, not makeinfo --html.
173 autosprintf_all.html: autosprintf.texi
174 $(TEXI2HTML) -expandinfo -number -monolithic `if test -f autosprintf.texi; then echo autosprintf.texi; else echo $(srcdir)/autosprintf.texi; fi`
175 mv autosprintf.html autosprintf_all.html
177 install-html: autosprintf_all.html
178 $(mkinstalldirs) $(DESTDIR)$(htmldir)
179 $(INSTALL_DATA) `if test -f autosprintf_all.html; then echo .; else echo $(srcdir); fi`/autosprintf_all.html $(DESTDIR)$(htmldir)/autosprintf.html
182 $(mkinstalldirs) $(DESTDIR)$(htmldir)
185 $(RM) $(DESTDIR)$(htmldir)/autosprintf.html
187 EXTRA_DIST += texi2html autosprintf_all.html
192 config.h_vms: config.h.in
193 (echo '#include <vms_jackets.h>'; \
194 sed -e 's/#undef HAVE_ALLOCA$$/#define HAVE_ALLOCA 1/' \
195 -e 's/#undef HAVE_DLFCN_H$$/#define HAVE_DLFCN_H 1/' \
196 -e 's/#undef HAVE_INTTYPES_H$$/#define HAVE_INTTYPES_H 1/' \
197 -e 's/#undef HAVE_LONG_DOUBLE$$/#define HAVE_LONG_DOUBLE 1/' \
198 -e 's/#undef HAVE_LONG_LONG$$/#define HAVE_LONG_LONG 1/' \
199 -e 's/#undef HAVE_MEMORY_H$$/#define HAVE_MEMORY_H 1/' \
200 -e 's/#undef HAVE_POSIX_PRINTF$$/#define HAVE_POSIX_PRINTF 1/' \
201 -e 's/#undef HAVE_PTRDIFF_T$$/#define HAVE_PTRDIFF_T 1/' \
202 -e 's/#undef HAVE_STDLIB_H$$/#define HAVE_STDLIB_H 1/' \
203 -e 's/#undef HAVE_STRINGS_H$$/#define HAVE_STRINGS_H 1/' \
204 -e 's/#undef HAVE_STRING_H$$/#define HAVE_STRING_H 1/' \
205 -e 's/#undef HAVE_SYS_STAT_H$$/#define HAVE_SYS_STAT_H 1/' \
206 -e 's/#undef HAVE_SYS_TYPES_H$$/#define HAVE_SYS_TYPES_H 1/' \
207 -e 's/#undef HAVE_UNISTD_H$$/#define HAVE_UNISTD_H 1/' \
208 -e 's/#undef HAVE_WCHAR_T$$/#define HAVE_WCHAR_T 1/' \
209 -e 's/#undef HAVE_WCSLEN$$/#define HAVE_WCSLEN 1/' \
210 -e 's/#undef HAVE_WINT_T$$/#define HAVE_WINT_T 1/' \
211 -e 's/#undef STDC_HEADERS$$/#define STDC_HEADERS 1/' \
212 < $(srcdir)/config.h.in; echo; echo '#define alloca __ALLOCA') > $@
214 EXTRA_DIST += Makefile.vms config.h_vms
219 config.h.msvc: config.h.in
220 sed -e 's/#undef HAVE_ALLOCA$$/#define HAVE_ALLOCA 1/' \
221 -e 's/#undef HAVE_DECL__SNPRINTF$$/#define HAVE_DECL__SNPRINTF 1/' \
222 -e 's/#undef HAVE_LONG_DOUBLE$$/#define HAVE_LONG_DOUBLE 1/' \
223 -e 's/#undef HAVE_PTRDIFF_T$$/#define HAVE_PTRDIFF_T 1/' \
224 -e 's/#undef HAVE_SNPRINTF$$/#define HAVE_SNPRINTF 1/' \
225 -e 's/#undef HAVE_STDLIB_H$$/#define HAVE_STDLIB_H 1/' \
226 -e 's/#undef HAVE_STRING_H$$/#define HAVE_STRING_H 1/' \
227 -e 's/#undef HAVE_WCHAR_T$$/#define HAVE_WCHAR_T 1/' \
228 -e 's/#undef HAVE_WCSLEN$$/#define HAVE_WCSLEN 1/' \
229 -e 's/#undef HAVE_WINT_T$$/#define HAVE_WINT_T 1/' \
230 -e 's/#undef SIZE_MAX$$/#define SIZE_MAX 4294967295U/' \
231 -e 's/#undef inline$$/#define inline __inline/' \
232 < $(srcdir)/config.h.in > $@
234 autosprintf.h.msvc-shared: autosprintf.h.in windows/dllexport.h
235 sed -e 's/extern \([^"]\)/extern LIBASPRINTF_DLL_EXPORTED \1/' \
236 -e 's/class /class LIBASPRINTF_DLL_EXPORTED /' \
237 -e 's/struct /struct LIBASPRINTF_DLL_EXPORTED /' \
238 -e '/#define _AUTOSPRINTF_H/r windows/dllexport.h' < $(srcdir)/autosprintf.h.in > $@
240 EXTRA_DIST += README.woe32 Makefile.msvc config.h.msvc autosprintf.h.msvc-shared windows/dllexport.h windows/asprintf.rc