1## Makefile for the gettext-runtime/libasprintf subdirectory of GNU gettext
2## Copyright (C) 2002-2005 Free Software Foundation, Inc.
3##
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)
7## 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 GNU
12## Library General Public License for more details.
13##
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,
17## USA.
18
19## Process this file with automake to produce Makefile.in.
20
21AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
22ACLOCAL_AMFLAGS = -I ../../m4 -I ../m4
23EXTRA_DIST =
24MOSTLYCLEANFILES =
25
26RM = rm -f
27
28
29# Library include file.
30
31include_HEADERS = autosprintf.h
32
33all-local $(libasprintf_la_OBJECTS): autosprintf.h
34autosprintf.h: autosprintf.h.in
35	cp $(srcdir)/autosprintf.h.in autosprintf.h
36MOSTLYCLEANFILES += autosprintf.h
37EXTRA_DIST += autosprintf.h.in
38
39dist-hook:
40	rm -f $(distdir)/autosprintf.h
41
42
43# Library code.
44
45lib_LTLIBRARIES = libasprintf.la
46
47libasprintf_la_SOURCES = \
48  lib-asprintf.h lib-asprintf.c \
49  autosprintf.h autosprintf.cc
50
51# Sources used only on platforms lacking vasprintf().
52lib_asprintf_EXTRASOURCES = \
53  xsize.h \
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
58lib-asprintf.lo: $(lib_asprintf_EXTRASOURCES)
59EXTRA_DIST += $(lib_asprintf_EXTRASOURCES)
60
61
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.
65libasprintf.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)
68
69
70# >>> gnulib module alloca.
71EXTRA_DIST += alloca_.h
72
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.
75all-local $(libasprintf_la_OBJECTS): @ALLOCA_H@
76alloca.h: alloca_.h
77	cp $(srcdir)/alloca_.h alloca.h
78MOSTLYCLEANFILES += alloca.h
79# <<< gnulib module alloca.
80
81
82# Clean up after Solaris cc.
83clean-local:
84	rm -rf SunWS_cache
85
86
87# Documentation.
88
89docdir = $(datadir)/doc/@PACKAGE@
90dvidir = $(docdir)
91psdir = $(docdir)
92pdfdir = $(docdir)
93htmldir = $(docdir)
94
95MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
96MAKEINFOFLAGS = --no-split
97
98info_TEXINFOS = autosprintf.texi
99
100# We distribute only the HTML documentation.
101# The user can generate the others, via
102#   make autosprintf.ps
103#   make autosprintf.pdf
104
105all-local: html-local
106install-data-local: install-html
107installdirs-local: installdirs-html
108uninstall-local: uninstall-html
109
110CLEANFILES = autosprintf.pdf
111# autosprintf.dvi and autosprintf.ps are already known to automake.
112
113
114# Documentation in DVI format.
115
116install-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
119
120installdirs-dvi:
121	$(mkinstalldirs) $(DESTDIR)$(dvidir)
122
123uninstall-dvi:
124	$(RM) $(DESTDIR)$(dvidir)/autosprintf.dvi
125
126# Temporary index files. automake removes only the predefined ones by itself.
127MOSTLYCLEANFILES +=
128
129
130# Documentation in Postscript format.
131
132# Override of automake's definition:
133#DVIPS = @DVIPS@
134DVIPS = @DVIPS@ -D600
135
136autosprintf.ps: autosprintf.dvi
137	$(DVIPS) -o $@ `if test -f autosprintf.dvi; then echo autosprintf.dvi; else echo $(srcdir)/autosprintf.dvi; fi`
138
139install-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
142
143installdirs-ps:
144	$(mkinstalldirs) $(DESTDIR)$(psdir)
145
146uninstall-ps:
147	$(RM) $(DESTDIR)$(psdir)/autosprintf.ps
148
149
150# Documentation in Portable Document Format.
151
152SUFFIXES = .pdf
153
154install-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
157
158installdirs-pdf:
159	$(mkinstalldirs) $(DESTDIR)$(pdfdir)
160
161uninstall-pdf:
162	$(RM) $(DESTDIR)$(pdfdir)/autosprintf.pdf
163
164
165# Documentation in HTML format.
166
167TEXI2HTML = @PERL@ $(srcdir)/texi2html
168
169html-local: autosprintf_all.html
170
171# Override of automake's definition.
172# We want to use texi2html, not makeinfo --html.
173autosprintf_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
176
177install-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
180
181installdirs-html:
182	$(mkinstalldirs) $(DESTDIR)$(htmldir)
183
184uninstall-html:
185	$(RM) $(DESTDIR)$(htmldir)/autosprintf.html
186
187EXTRA_DIST += texi2html autosprintf_all.html
188
189
190# VMS support.
191
192config.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') > $@
213
214EXTRA_DIST += Makefile.vms config.h_vms
215
216
217# Woe32 support.
218
219config.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 > $@
233
234autosprintf.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 > $@
239
240EXTRA_DIST += README.woe32 Makefile.msvc config.h.msvc autosprintf.h.msvc-shared windows/dllexport.h windows/asprintf.rc
241