1 # Makefile for directory with message catalog handling library of GNU gettext
2 # Copyright (C) 1995-1998, 2000-2003 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@
30 exec_prefix = @exec_prefix@
31 datarootdir = @datarootdir@
32 transform = @program_transform_name@
34 includedir = @includedir@
36 localedir = $(datadir)/locale
37 gettextsrcdir = $(datadir)/gettext/intl
38 aliaspath = $(localedir)
42 INSTALL_DATA = @INSTALL_DATA@
43 MKINSTALLDIRS = @MKINSTALLDIRS@
44 mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
49 @ifGNUmake@ ifeq ($(strip $(V)),)
50 @ifGNUmake@ # E = @echo
59 @ifNotGNUmake@ E = @E@
60 @ifNotGNUmake@ Q = @Q@
62 @ifGNUmake@ CHECK=sparse
63 @ifGNUmake@ CHECK_OPTS=-Wsparse-all -Wno-transparent-union -Wno-return-void -Wno-undef -Wno-non-pointer-null
64 @ifGNUmake@ CPPCHECK=cppcheck
65 @ifGNUmake@ CPPCHECK_OPTS=--force --enable=all --quiet --check-config
66 @ifGNUmake@ ifeq ("$(C)", "2")
67 @ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS) -Wbitwise -D__CHECK_ENDIAN__
68 @ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
70 @ifGNUmake@ ifeq ("$(C)", "1")
71 @ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS)
72 @ifGNUmake@ CPPCHECK_CMD=$(CPPCHECK) $(CPPCHECK_OPTS)
74 @ifGNUmake@ CHECK_CMD=@true
75 @ifGNUmake@ CPPCHECK_CMD=@true
79 @ifNotGNUmake@ CHECK_CMD=@true
80 @ifNotGNUmake@ CPPCHECK_CMD=@true
82 l = @INTL_LIBTOOL_SUFFIX_PREFIX@
88 YACC = @INTLBISON@ -y -d
89 YFLAGS = --name-prefix=__gettext
91 DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \
92 -DLIBDIR=\"$(libdir)\" -DIN_LIBINTL \
93 -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"$(libdir)\" -DNO_XMALLOC \
94 -Dset_relocation_prefix=libintl_set_relocation_prefix \
95 -Drelocate=libintl_relocate \
96 -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H
102 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
114 printf-args.h printf-args.c \
115 printf-parse.h wprintf-parse.h printf-parse.c \
116 vasnprintf.h vasnwprintf.h vasnprintf.c \
168 DISTFILES.common = Makefile.in \
169 config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES)
170 DISTFILES.generated = plural.c
171 DISTFILES.normal = VERSION
172 DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc \
173 libgnuintl.h_vms Makefile.vms \
174 libgnuintl.h.msvc-static libgnuintl.h.msvc-shared README.woe32 Makefile.msvc
175 DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \
176 COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h
178 all: all-@USE_INCLUDED_LIBINTL@
179 all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
180 all-no: all-no-@BUILD_INCLUDED_LIBINTL@
181 all-no-yes: libgnuintl.$la
184 libintl.a libgnuintl.a: $(OBJECTS)
187 $(Q) $(AR) cru $@ $(OBJECTS)
191 libintl.la libgnuintl.la: $(OBJECTS)
192 $(LIBTOOL) --mode=link \
193 $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \
194 $(OBJECTS) @LTLIBICONV@ $(LIBS) -lc \
195 -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \
199 # Libtool's library version information for libintl.
200 # Before making a gettext release, the gettext maintainer must change this
201 # according to the libtool documentation, section "Library interface versions".
202 # Maintainers of other packages that include the intl directory must *not*
203 # change these values.
209 .SUFFIXES: .c .y .o .lo .sin .sed
214 $(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
215 $(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $<
218 $(YACC) $(YFLAGS) --output $@ $<
221 bindtextdom.lo: $(srcdir)/bindtextdom.c
222 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c
223 dcgettext.lo: $(srcdir)/dcgettext.c
224 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcgettext.c
225 dgettext.lo: $(srcdir)/dgettext.c
226 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dgettext.c
227 gettext.lo: $(srcdir)/gettext.c
228 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c
229 finddomain.lo: $(srcdir)/finddomain.c
230 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c
231 loadmsgcat.lo: $(srcdir)/loadmsgcat.c
232 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
233 localealias.lo: $(srcdir)/localealias.c
234 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localealias.c
235 textdomain.lo: $(srcdir)/textdomain.c
236 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/textdomain.c
237 l10nflist.lo: $(srcdir)/l10nflist.c
238 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/l10nflist.c
239 explodename.lo: $(srcdir)/explodename.c
240 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/explodename.c
241 dcigettext.lo: $(srcdir)/dcigettext.c
242 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcigettext.c
243 dcngettext.lo: $(srcdir)/dcngettext.c
244 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dcngettext.c
245 dngettext.lo: $(srcdir)/dngettext.c
246 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/dngettext.c
247 ngettext.lo: $(srcdir)/ngettext.c
248 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/ngettext.c
249 plural.lo: $(srcdir)/plural.c
250 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural.c
251 plural-exp.lo: $(srcdir)/plural-exp.c
252 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
253 localcharset.lo: $(srcdir)/localcharset.c
254 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localcharset.c
255 relocatable.lo: $(srcdir)/relocatable.c
256 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/relocatable.c
257 localename.lo: $(srcdir)/localename.c
258 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c
259 log.lo: $(srcdir)/log.c
260 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c
261 printf.lo: $(srcdir)/printf.c
262 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c
263 osdep.lo: $(srcdir)/osdep.c
264 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c
265 intl-compat.lo: $(srcdir)/intl-compat.c
266 $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/intl-compat.c
268 ref-add.sed: $(srcdir)/ref-add.sin
269 $(E) " SED ref-add.sed"
270 $(Q) sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-add.sin > t-ref-add.sed
271 $(Q) mv t-ref-add.sed ref-add.sed
272 ref-del.sed: $(srcdir)/ref-del.sin
273 $(E) " SED ref-del.sed"
274 $(Q) sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $(srcdir)/ref-del.sin > t-ref-del.sed
275 $(Q) mv t-ref-del.sed ref-del.sed
277 INCLUDES = -I. -I$(srcdir) -I.. -I$(top_builddir)/lib
279 libgnuintl.h: $(srcdir)/libgnuintl.h.in
280 $(E) " SED libgnuintl.h "
281 $(Q) sed -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \
282 -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \
283 -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \
284 -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \
285 < $(srcdir)/libgnuintl.h.in > libgnuintl.h
287 libintl.h: libgnuintl.h
289 $(Q) cp libgnuintl.h libintl.h
291 charset.alias: $(srcdir)/config.charset
292 $(E) " CONFIG.CHARSET $@"
293 $(Q) $(SHELL) $(srcdir)/config.charset '@host@' > t-$@
298 # We must not install the libintl.h/libintl.a files if we are on a
299 # system which has the GNU gettext() function in its C library or in a
301 # If you want to use the one which comes with this version of the
302 # package, you have to use `configure --with-included-gettext'.
303 install: install-exec install-data
305 $(Q) if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
306 && test '@USE_INCLUDED_LIBINTL@' = yes; then \
307 $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
308 $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \
309 $(LIBTOOL) --mode=install \
310 $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \
311 if test "@RELOCATABLE@" = yes; then \
312 dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \
313 if test -n "$$dependencies"; then \
314 rm -f $(DESTDIR)$(libdir)/libintl.la; \
320 $(Q) if test "$(PACKAGE)" = "gettext-tools" \
321 && test '@USE_INCLUDED_LIBINTL@' = no; then \
322 $(mkinstalldirs) $(DESTDIR)$(libdir); \
323 $(LIBTOOL) --mode=install \
324 $(INSTALL_DATA) libgnuintl.$la $(DESTDIR)$(libdir)/libgnuintl.$la; \
325 rm -f $(DESTDIR)$(libdir)/preloadable_libintl.so; \
326 $(INSTALL_DATA) $(DESTDIR)$(libdir)/libgnuintl.so $(DESTDIR)$(libdir)/preloadable_libintl.so; \
327 $(LIBTOOL) --mode=uninstall \
328 rm -f $(DESTDIR)$(libdir)/libgnuintl.$la; \
332 if test '@USE_INCLUDED_LIBINTL@' = yes; then \
333 test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
334 temp=$(DESTDIR)$(libdir)/t-charset.alias; \
335 dest=$(DESTDIR)$(libdir)/charset.alias; \
336 if test -f $(DESTDIR)$(libdir)/charset.alias; then \
337 orig=$(DESTDIR)$(libdir)/charset.alias; \
338 sed -f ref-add.sed $$orig > $$temp; \
339 $(INSTALL_DATA) $$temp $$dest; \
342 if test @GLIBC21@ = no; then \
343 orig=charset.alias; \
344 sed -f ref-add.sed $$orig > $$temp; \
345 $(INSTALL_DATA) $$temp $$dest; \
349 $(mkinstalldirs) $(DESTDIR)$(localedir); \
350 test -f $(DESTDIR)$(localedir)/locale.alias \
351 && orig=$(DESTDIR)$(localedir)/locale.alias \
352 || orig=$(srcdir)/locale.alias; \
353 temp=$(DESTDIR)$(localedir)/t-locale.alias; \
354 dest=$(DESTDIR)$(localedir)/locale.alias; \
355 sed -f ref-add.sed $$orig > $$temp; \
356 $(INSTALL_DATA) $$temp $$dest; \
362 $(Q) if test "$(PACKAGE)" = "gettext-tools"; then \
363 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
364 $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \
365 $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \
366 dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \
367 for file in $$dists; do \
368 $(INSTALL_DATA) $(srcdir)/$$file \
369 $(DESTDIR)$(gettextsrcdir)/$$file; \
371 chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \
372 dists="$(DISTFILES.generated)"; \
373 for file in $$dists; do \
374 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
375 $(INSTALL_DATA) $$dir/$$file \
376 $(DESTDIR)$(gettextsrcdir)/$$file; \
378 dists="$(DISTFILES.obsolete)"; \
379 for file in $$dists; do \
380 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
386 install-strip: install
389 if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
390 && test '@USE_INCLUDED_LIBINTL@' = yes; then \
391 $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \
395 if test "$(PACKAGE)" = "gettext-tools" \
396 && test '@USE_INCLUDED_LIBINTL@' = no; then \
397 $(mkinstalldirs) $(DESTDIR)$(libdir); \
401 if test '@USE_INCLUDED_LIBINTL@' = yes; then \
402 test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \
403 $(mkinstalldirs) $(DESTDIR)$(localedir); \
407 if test "$(PACKAGE)" = "gettext-tools"; then \
408 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
413 # Define this as empty until I found a useful application.
420 install-shlibs-strip:
423 if { test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; } \
424 && test '@USE_INCLUDED_LIBINTL@' = yes; then \
425 rm -f $(DESTDIR)$(includedir)/libintl.h; \
426 $(LIBTOOL) --mode=uninstall \
427 rm -f $(DESTDIR)$(libdir)/libintl.$la; \
431 if test "$(PACKAGE)" = "gettext-tools" \
432 && test '@USE_INCLUDED_LIBINTL@' = 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): 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 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 localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h
481 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
485 TAGS: $(HEADERS) $(SOURCES)
486 here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
490 CTAGS: $(HEADERS) $(SOURCES)
491 here=`pwd`; cd $(srcdir) && ctags -o $$here/CTAGS $(HEADERS) $(SOURCES)
495 ID: $(HEADERS) $(SOURCES)
496 here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
501 rm -f *.a *.la *.o *.obj *.lo core core.*
502 rm -f libgnuintl.h libintl.h charset.alias ref-add.sed ref-del.sed
508 rm -f Makefile ID TAGS
509 if test "$(PACKAGE)" = "gettext-runtime" || test "$(PACKAGE)" = "gettext-tools"; then \
510 rm -f ChangeLog.inst $(DISTFILES.normal); \
515 maintainer-clean: distclean
516 $(E) "This command is intended for maintainers to use;"
517 $(E) "it deletes files that may require special tools to rebuild."
520 # GNU gettext needs not contain the file `VERSION' but contains some
521 # other files which should not be distributed in other packages.
522 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
523 dist distdir: Makefile
524 if test "$(PACKAGE)" = "gettext-tools"; then \
527 if test "$(PACKAGE)" = "gettext-runtime"; then \
528 additional="$(DISTFILES.gettext)"; \
530 additional="$(DISTFILES.normal)"; \
532 $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \
533 for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \
534 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
535 cp -p $$dir/$$file $(distdir); \
539 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
540 # cd $(top_builddir) && $(SHELL) ./config.status
541 # This would be more efficient, but doesn't work any more with autoconf-2.57,
542 # when AC_CONFIG_FILES([intl/Makefile:somedir/Makefile.in]) is used.
543 cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
545 # Tell versions [3.59,3.63) of GNU make not to export all variables.
546 # Otherwise a system limit (for SysV at least) may be exceeded.