2005-10-31 [mones] 1.9.15cvs128
[claws.git] / po / Makefile.in.in
index 111b40f..c995182 100644 (file)
@@ -5,7 +5,14 @@
 # be used in projects which are not available under the GNU Public License
 # but which still want to provide support for the GNU gettext functionality.
 # Please note that the actual code is *not* freely available.
+#
+# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
+#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+# - Modified by jacob berkman <jacob@ximian.com> to install
+#   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
 
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 
@@ -18,10 +25,11 @@ VPATH = @srcdir@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
-datadir = $(prefix)/@DATADIRNAME@
-localedir = $(datadir)/locale
-gnulocaledir = $(prefix)/share/locale
-gettextsrcdir = $(prefix)/share/gettext/po
+datadir = @datadir@
+libdir = @libdir@
+localedir = $(libdir)/locale
+gnulocaledir = $(datadir)/locale
+gettextsrcdir = $(datadir)/glib-2.0/gettext/po
 subdir = po
 
 INSTALL = @INSTALL@
@@ -30,10 +38,10 @@ MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
 
 CC = @CC@
 GENCAT = @GENCAT@
-GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
+GMSGFMT = @GMSGFMT@
 MSGFMT = @MSGFMT@
-XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
-MSGMERGE = PATH=../src:$$PATH msgmerge
+XGETTEXT = @XGETTEXT@
+MSGMERGE = msgmerge
 
 DEFS = @DEFS@
 CFLAGS = @CFLAGS@
@@ -43,11 +51,11 @@ INCLUDES = -I.. -I$(top_srcdir)/intl
 
 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
 
-SOURCES = cat-id-tbl.c
+SOURCES = 
 POFILES = @POFILES@
 GMOFILES = @GMOFILES@
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
-stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
+DISTFILES = Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
+$(POFILES) $(GMOFILES) $(SOURCES)
 
 POTFILES = \
 
@@ -62,15 +70,15 @@ INSTOBJEXT = @INSTOBJEXT@
        $(COMPILE) $<
 
 .po.pox:
-       $(MAKE) $(PACKAGE).pot
-       $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
 
 .po.mo:
-       $(MSGFMT) -o $@ $<
+       $(MSGFMT) -c -o $@ $<
 
 .po.gmo:
        file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
-         && rm -f $$file && $(GMSGFMT) -o $$file $<
+         && rm -f $$file && $(GMSGFMT) -c --statistics -o $$file $<
 
 .po.cat:
        sed -f ../intl/po2msg.sed < $< > $*.msg \
@@ -79,31 +87,17 @@ INSTOBJEXT = @INSTOBJEXT@
 
 all: all-@USE_NLS@
 
-all-yes: cat-id-tbl.c $(CATALOGS)
+all-yes: $(CATALOGS)
 all-no:
 
-$(srcdir)/$(PACKAGE).pot: $(POTFILES)
-       $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
          --add-comments --keyword=_ --keyword=N_ \
          --files-from=$(srcdir)/POTFILES.in \
-       && test ! -f $(PACKAGE).po \
-          || ( rm -f $(srcdir)/$(PACKAGE).pot \
-               && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
-
-$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
-$(srcdir)/stamp-cat-id: $(PACKAGE).pot
-       rm -f cat-id-tbl.tmp
-       sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
-               | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
-       if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
-         rm cat-id-tbl.tmp; \
-       else \
-         echo cat-id-tbl.c changed; \
-         rm -f $(srcdir)/cat-id-tbl.c; \
-         mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
-       fi
-       cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
-
+         --msgid-bugs-address='twb@users.sourceforge.net' \
+       && test ! -f $(GETTEXT_PACKAGE).po \
+          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
 
 install: install-exec install-data
 install-exec:
@@ -111,9 +105,9 @@ install-data: install-data-@USE_NLS@
 install-data-no: all
 install-data-yes: all
        if test -r "$(MKINSTALLDIRS)"; then \
-         $(MKINSTALLDIRS) $(datadir); \
+         $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
        else \
-         $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
+         $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
        fi
        @catalogs='$(CATALOGS)'; \
        for cat in $$catalogs; do \
@@ -123,42 +117,42 @@ install-data-yes: all
            *)     destdir=$(localedir);; \
          esac; \
          lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
-         dir=$$destdir/$$lang/LC_MESSAGES; \
+         dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
          if test -r "$(MKINSTALLDIRS)"; then \
            $(MKINSTALLDIRS) $$dir; \
          else \
            $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
          fi; \
          if test -r $$cat; then \
-           $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
-           echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+           $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
          else \
-           $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+           $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
            echo "installing $(srcdir)/$$cat as" \
-                "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+                "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
          fi; \
          if test -r $$cat.m; then \
-           $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
-           echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+           $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+           echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
          else \
            if test -r $(srcdir)/$$cat.m ; then \
              $(INSTALL_DATA) $(srcdir)/$$cat.m \
-               $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+               $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
              echo "installing $(srcdir)/$$cat as" \
-                  "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
            else \
              true; \
            fi; \
          fi; \
        done
-       if test "$(PACKAGE)" = "gettext"; then \
+       if test "$(PACKAGE)" = "glib"; then \
          if test -r "$(MKINSTALLDIRS)"; then \
-           $(MKINSTALLDIRS) $(gettextsrcdir); \
+           $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
          else \
-           $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
          fi; \
          $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
-                         $(gettextsrcdir)/Makefile.in.in; \
+                         $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
        else \
          : ; \
        fi
@@ -171,21 +165,21 @@ uninstall:
        for cat in $$catalogs; do \
          cat=`basename $$cat`; \
          lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
-         rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
-         rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
-         rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
-         rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+         rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+         rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
        done
-       rm -f $(gettextsrcdir)/po-Makefile.in.in
+       if test "$(PACKAGE)" = "glib"; then \
+         rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
+       fi
 
 check: all
 
-cat-id-tbl.o: ../intl/libgettext.h
-
 dvi info tags TAGS ID:
 
 mostlyclean:
-       rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
+       rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
        rm -fr *.o
 
 clean: mostlyclean
@@ -198,7 +192,7 @@ maintainer-clean: distclean
        @echo "it deletes files that may require special tools to rebuild."
        rm -f $(GMOFILES)
 
-distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
 dist distdir: update-po $(DISTFILES)
        dists="$(DISTFILES)"; \
        for file in $$dists; do \
@@ -207,24 +201,35 @@ dist distdir: update-po $(DISTFILES)
        done
 
 update-po: Makefile
-       $(MAKE) $(PACKAGE).pot
-       PATH=`pwd`/../src:$$PATH; \
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       tmpdir=`pwd`; \
        cd $(srcdir); \
        catalogs='$(CATALOGS)'; \
        for cat in $$catalogs; do \
          cat=`basename $$cat`; \
          lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
-         mv $$lang.po $$lang.old.po; \
          echo "$$lang:"; \
-         if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
-           rm -f $$lang.old.po; \
+         if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
+           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+             rm -f $$tmpdir/$$lang.new.po; \
+            else \
+             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+               :; \
+             else \
+               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+               rm -f $$tmpdir/$$lang.new.po; \
+               exit 1; \
+             fi; \
+           fi; \
          else \
            echo "msgmerge for $$cat failed!"; \
-           rm -f $$lang.po; \
-           mv $$lang.old.po $$lang.po; \
+           rm -f $$tmpdir/$$lang.new.po; \
          fi; \
        done
 
+# POTFILES is created from POTFILES.in by stripping comments, empty lines
+# and Intltool tags (enclosed in square brackets), and appending a full
+# relative path to them
 POTFILES: POTFILES.in
        ( if test 'x$(srcdir)' != 'x.'; then \
            posrcprefix='$(top_srcdir)/'; \
@@ -232,8 +237,10 @@ POTFILES: POTFILES.in
            posrcprefix="../"; \
          fi; \
          rm -f $@-t $@ \
-           && (sed -e '/^#/d' -e '/^[  ]*$$/d' \
-                   -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+           && (sed -e '/^#/d'                                          \
+                   -e "s/^\[.*\] +//"                                  \
+                   -e '/^[     ]*$$/d'                                 \
+                   -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
                | sed -e '$$s/\\$$//') > $@-t \
            && chmod a-w $@-t \
            && mv $@-t $@ )