1 # Makefile for directory with message catalog handling library of GNU gettext
2 # Copyright (C) 1995-1998, 2000-2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 top_srcdir = @top_srcdir@
28 # The VPATH variables allows builds with $builddir != $srcdir, assuming a
29 # 'make' program that supports VPATH (such as GNU make). This line is removed
30 # by autoconf automatically when "$(srcdir)" = ".".
31 # In this directory, the VPATH handling is particular:
32 # 1. If INTL_LIBTOOL_SUFFIX_PREFIX is 'l' (indicating a build with libtool),
33 # the .c -> .lo rules carefully use $(srcdir), so that VPATH can be omitted.
34 # 2. If PACKAGE = gettext-tools, VPATH _must_ be omitted, because otherwise
35 # 'make' does the wrong thing if GNU gettext was configured with
36 # "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la
37 # files it finds in srcdir = ../../gettext-runtime/intl.
41 exec_prefix = @exec_prefix@
42 transform = @program_transform_name@
44 includedir = @includedir@
45 datarootdir = @datarootdir@
47 localedir = $(datadir)/locale
48 gettextsrcdir = $(datadir)/gettext/intl
49 aliaspath = $(localedir)
53 INSTALL_DATA = @INSTALL_DATA@
54 mkinstalldirs = @install_sh@ -d
57 l = @INTL_LIBTOOL_SUFFIX_PREFIX@
63 YACC = @INTLBISON@ -y -d
64 YFLAGS = --name-prefix=__gettext
66 # -DBUILDING_LIBINTL: Change expansion of LIBINTL_DLL_EXPORTED macro.
67 # -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro.
68 DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
69 -DLIBDIR=\"$(libdir)\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL \
70 -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
71 -Dset_relocation_prefix=libintl_set_relocation_prefix \
72 -Drelocate=libintl_relocate \
73 -DDEPENDS_ON_LIBICONV=1 @DEFS@
75 CFLAGS = @CFLAGS@ @CFLAG_VISIBILITY@
76 LDFLAGS = @LDFLAGS@ $(LDFLAGS_@WOE32DLL@)
77 LDFLAGS_yes = -Wl,--export-all-symbols
81 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
94 printf-args.h printf-args.c \
95 printf-parse.h wprintf-parse.h printf-parse.c \
96 vasnprintf.h vasnwprintf.h vasnprintf.c \
157 DISTFILES.common = Makefile.in \
158 config.charset locale.alias ref-add.sin ref-del.sin export.h \
159 $(HEADERS) $(SOURCES)
160 DISTFILES.generated = plural.c
161 DISTFILES.normal = VERSION
162 DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc \
163 libgnuintl.h_vms Makefile.vms \
164 libgnuintl.h.msvc-static libgnuintl.h.msvc-shared README.woe32 Makefile.msvc
165 DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
166 COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h
168 all: all-@USE_INCLUDED_LIBINTL@
169 all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
170 all-no: all-no-@BUILD_INCLUDED_LIBINTL@
171 all-no-yes: libgnuintl.$la
174 libintl.a libgnuintl.a: $(OBJECTS)
176 $(AR) cru $@ $(OBJECTS)
179 libintl.la libgnuintl.la: $(OBJECTS)
180 $(LIBTOOL) --mode=link \
181 $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
182 $(OBJECTS) @LTLIBICONV@ @INTL_MACOSX_LIBS@ $(LIBS) @LTLIBTHREAD@ -lc \
183 -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
187 # Libtool's library version information for libintl.
188 # Before making a gettext release, the gettext maintainer must change this
189 # according to the libtool documentation, section "Library interface versions".
190 # Maintainers of other packages that include the intl directory must *not*
191 # change these values.
197 .SUFFIXES: .c .y .o .lo .sin .sed
203 $(YACC) $(YFLAGS) --output $@ $<
206 bindtextdom.lo: $(srcdir)/bindtextdom.c
207 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c
208 dcgettext.lo: $(srcdir)/dcgettext.c
209 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcgettext.c
210 dgettext.lo: $(srcdir)/dgettext.c
211 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dgettext.c
212 gettext.lo: $(srcdir)/gettext.c
213 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c
214 finddomain.lo: $(srcdir)/finddomain.c
215 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c
216 hash-string.lo: $(srcdir)/hash-string.c
217 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/hash-string.c
218 loadmsgcat.lo: $(srcdir)/loadmsgcat.c
219 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
220 localealias.lo: $(srcdir)/localealias.c
221 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localealias.c
222 textdomain.lo: $(srcdir)/textdomain.c
223 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/textdomain.c
224 l10nflist.lo: $(srcdir)/l10nflist.c
225 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/l10nflist.c
226 explodename.lo: $(srcdir)/explodename.c
227 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/explodename.c
228 dcigettext.lo: $(srcdir)/dcigettext.c
229 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcigettext.c
230 dcngettext.lo: $(srcdir)/dcngettext.c
231 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcngettext.c
232 dngettext.lo: $(srcdir)/dngettext.c
233 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dngettext.c
234 ngettext.lo: $(srcdir)/ngettext.c
235 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/ngettext.c
236 plural.lo: $(srcdir)/plural.c
237 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural.c
238 plural-exp.lo: $(srcdir)/plural-exp.c
239 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
240 localcharset.lo: $(srcdir)/localcharset.c
241 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
242 lock.lo: $(srcdir)/lock.c
243 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/lock.c
244 relocatable.lo: $(srcdir)/relocatable.c
245 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c
246 langprefs.lo: $(srcdir)/langprefs.c
247 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/langprefs.c
248 localename.lo: $(srcdir)/localename.c
249 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c
250 log.lo: $(srcdir)/log.c
251 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c
252 printf.lo: $(srcdir)/printf.c
253 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c
254 version.lo: $(srcdir)/version.c
255 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/version.c
256 osdep.lo: $(srcdir)/osdep.c
257 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c
258 intl-compat.lo: $(srcdir)/intl-compat.c
259 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/intl-compat.c
261 ref-add.sed: $(srcdir)/ref-add.sin
262 sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-ref-add.sed
263 mv t-ref-add.sed ref-add.sed
264 ref-del.sed: $(srcdir)/ref-del.sin
265 sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-ref-del.sed
266 mv t-ref-del.sed ref-del.sed
268 INCLUDES = -I. -I$(srcdir) -I..
270 libgnuintl.h: $(srcdir)/libgnuintl.h.in
271 sed -e '/IN_LIBGLOCALE/d' \
272 -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
273 -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
274 -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
275 -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
276 < $(srcdir)/libgnuintl.h.in \
277 | if test '@WOE32DLL@' = yes; then \
278 sed -e 's/extern \([^()]*\);/extern __declspec (dllimport) \1;/'; \
282 | sed -e 's/extern \([^"]\)/extern LIBINTL_DLL_EXPORTED \1/' \
283 -e "/#define _LIBINTL_H/r $(srcdir)/export.h" \
284 | sed -e 's,@''HAVE_VISIBILITY''@,@HAVE_VISIBILITY@,g' \
287 libintl.h: $(srcdir)/libgnuintl.h.in
288 sed -e '/IN_LIBGLOCALE/d' \
289 -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
290 -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
291 -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
292 -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
293 < $(srcdir)/libgnuintl.h.in > libintl.h
295 charset.alias: $(srcdir)/config.charset
296 $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
301 # We must not install the libintl.h/libintl.a files if we are on a
302 # system which has the GNU gettext() function in its C library or in a
304 # If you want to use the one which comes with this version of the
305 # package, you have to use `configure --with-included-gettext'.
306 install: install-exec install-data
308 if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
309 && test '@USE_INCLUDED_LIBINTL@' = yes; then \
310 $(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
311 $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
312 $(LIBTOOL) --mode=install \
313 $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
314 if test "@RELOCATABLE@" = yes; then \
315 dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \
316 if test -n "$$dependencies"; then \
317 rm -f $(DESTDIR)$(libdir)/libintl.la; \
323 if test "$(PACKAGE)" = "gettext-tools" \
324 && test '@USE_INCLUDED_LIBINTL@' = no \
325 && test @GLIBC2@ != no; then \
326 $(mkdir_p) $(DESTDIR)$(libdir); \
327 $(LIBTOOL) --mode=install \
328 $(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \
329 rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
330 $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so; \
331 $(LIBTOOL) --mode=uninstall \
332 rm -f $(DESTDIR)$(libdir)/libgnuintl.$la; \
336 if test '@USE_INCLUDED_LIBINTL@' = yes; then \
337 test @GLIBC21@ != no || $(mkdir_p) $(DESTDIR)$(libdir); \
338 temp=$(DESTDIR)$(libdir)/t-charset.alias; \
339 dest=$(DESTDIR)$(libdir)/charset.alias; \
340 if test -f $(DESTDIR)$(libdir)/charset.alias; then \
341 orig=$(DESTDIR)$(libdir)/charset.alias; \
342 sed -f ref-add.sed $$orig > $$temp; \
343 $(INSTALL_DATA) $$temp $$dest; \
346 if test @GLIBC21@ = no; then \
347 orig=charset.alias; \
348 sed -f ref-add.sed $$orig > $$temp; \
349 $(INSTALL_DATA) $$temp $$dest; \
353 $(mkdir_p) $(DESTDIR)$(localedir); \
354 test -f $(DESTDIR)$(localedir)/locale.alias \
355 && orig=$(DESTDIR)$(localedir)/locale.alias \
356 || orig=$(srcdir)/locale.alias; \
357 temp=$(DESTDIR)$(localedir)/t-locale.alias; \
358 dest=$(DESTDIR)$(localedir)/locale.alias; \
359 sed -f ref-add.sed $$orig > $$temp; \
360 $(INSTALL_DATA) $$temp $$dest; \
366 if test "$(PACKAGE)" = "gettext-tools"; then \
367 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
368 $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
369 $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
370 dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
371 for file in $$dists; do \
372 $(INSTALL_DATA) $(srcdir)/$$file \
373 $(DESTDIR)$(gettextsrcdir)/$$file; \
375 chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
376 dists="$(DISTFILES.generated)"; \
377 for file in $$dists; do \
378 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
379 $(INSTALL_DATA) $$dir/$$file \
380 $(DESTDIR)$(gettextsrcdir)/$$file; \
382 dists="$(DISTFILES.obsolete)"; \
383 for file in $$dists; do \
384 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
390 install-strip: install
393 if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
394 && test '@USE_INCLUDED_LIBINTL@' = yes; then \
395 $(mkdir_p) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
399 if test "$(PACKAGE)" = "gettext-tools" \
400 && test '@USE_INCLUDED_LIBINTL@' = no \
401 && test @GLIBC2@ != no; then \
402 $(mkdir_p) $(DESTDIR)$(libdir); \
406 if test '@USE_INCLUDED_LIBINTL@' = yes; then \
407 test @GLIBC21@ != no || $(mkdir_p) $(DESTDIR)$(libdir); \
408 $(mkdir_p) $(DESTDIR)$(localedir); \
412 if test "$(PACKAGE)" = "gettext-tools"; then \
413 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
418 # Define this as empty until I found a useful application.
422 if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
423 && test '@USE_INCLUDED_LIBINTL@' = yes; then \
424 rm -f $(DESTDIR)$(includedir)/libintl.h; \
425 $(LIBTOOL) --mode=uninstall \
426 rm -f $(DESTDIR)$(libdir)/libintl.$la; \
430 if test "$(PACKAGE)" = "gettext-tools" \
431 && test '@USE_INCLUDED_LIBINTL@' = no \
432 && test @GLIBC2@ != no; then \
433 rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
437 if test '@USE_INCLUDED_LIBINTL@' = yes; then \
438 if test -f $(DESTDIR)$(libdir)/charset.alias; then \
439 temp=$(DESTDIR)$(libdir)/t-charset.alias; \
440 dest=$(DESTDIR)$(libdir)/charset.alias; \
441 sed -f ref-del.sed $$dest > $$temp; \
442 if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
445 $(INSTALL_DATA) $$temp $$dest; \
449 if test -f $(DESTDIR)$(localedir)/locale.alias; then \
450 temp=$(DESTDIR)$(localedir)/t-locale.alias; \
451 dest=$(DESTDIR)$(localedir)/locale.alias; \
452 sed -f ref-del.sed $$dest > $$temp; \
453 if grep '^# Packages using this file: $$' $$temp > /dev/null; then \
456 $(INSTALL_DATA) $$temp $$dest; \
463 if test "$(PACKAGE)" = "gettext-tools"; then \
464 for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \
465 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
471 info dvi ps pdf html:
473 $(OBJECTS): ../config.h libgnuintl.h
474 bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: $(srcdir)/gettextP.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h
475 hash-string.$lo dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
476 explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h
477 dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h
478 dcigettext.$lo: $(srcdir)/eval-plural.h
479 localcharset.$lo: $(srcdir)/localcharset.h
480 bindtextdom.$lo dcigettext.$lo finddomain.$lo loadmsgcat.$lo localealias.$lo lock.$lo log.$lo: $(srcdir)/lock.h
481 localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
482 printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c
484 # A bison-2.1 generated plural.c includes <libintl.h> if ENABLE_NLS.
485 PLURAL_DEPS_yes = libintl.h
487 plural.$lo: $(PLURAL_DEPS_@USE_INCLUDED_LIBINTL@)
491 TAGS: $(HEADERS) $(SOURCES)
492 here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
496 CTAGS: $(HEADERS) $(SOURCES)
497 here=`pwd`; cd $(srcdir) && ctags -o $$here/CTAGS $(HEADERS) $(SOURCES)
501 ID: $(HEADERS) $(SOURCES)
502 here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
506 rm -f *.a *.la *.o *.obj *.lo core core.*
507 rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
513 rm -f Makefile ID TAGS
514 if test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; then \
515 rm -f ChangeLog.inst $(DISTFILES.normal); \
520 maintainer-clean: distclean
521 @echo "This command is intended for maintainers to use;"
522 @echo "it deletes files that may require special tools to rebuild."
525 # GNU gettext needs not contain the file `VERSION' but contains some
526 # other files which should not be distributed in other packages.
527 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
528 dist distdir: Makefile
529 if test "$(PACKAGE)" = "gettext-tools"; then \
532 if test "$(PACKAGE)" = "gettext-runtime"; then \
533 additional="$(DISTFILES.gettext)"; \
535 additional="$(DISTFILES.normal)"; \
537 $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
538 for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
539 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
540 cp -p $$dir/$$file $(distdir) || test $$file = Makefile.in || exit 1; \
544 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
545 cd $(top_builddir) && $(SHELL) ./config.status
546 # This would be more efficient, but doesn't work any more with autoconf-2.57,
547 # when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used.
548 # cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
550 # Tell versions [3.59,3.63) of GNU make not to export all variables.
551 # Otherwise a system limit (for SysV at least) may be exceeded.