]> granicus.if.org Git - postgresql/blobdiff - src/nls-global.mk
Some code review for xml.c:
[postgresql] / src / nls-global.mk
index 1576b48c07397dbd10dea6b2ac1e03f8f06ae5c5..e2d44f3e41a69eed5b9f209757fe831cb9511ef5 100644 (file)
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/src/nls-global.mk,v 1.5 2002/08/21 20:42:24 petere Exp $
+# $PostgreSQL: pgsql/src/nls-global.mk,v 1.12 2006/04/05 13:40:15 petere Exp $
 
 # Common rules for Native Language Support (NLS)
 #
@@ -6,11 +6,11 @@
 # needs to contain a file 'nls.mk' with the following make variable
 # assignments:
 #
-# CATALOG_NAME         -- name of the message catalog (xxx.po); probably
-#                          name of the program
+# CATALOG_NAME         -- name of the message catalog (xxx.po); probably
+#                         name of the program
 # AVAIL_LANGUAGES      -- list of languages that are provided/supported
-# GETTEXT_FILES         -- list of source files that contain message strings
-# GETTEXT_TRIGGERS      -- (optional) list of functions that contain
+# GETTEXT_FILES                -- list of source files that contain message strings
+# GETTEXT_TRIGGERS     -- (optional) list of functions that contain
 #                          translatable strings
 #
 # That's all, the rest is done here, if --enable-nls was specified.
@@ -42,21 +42,20 @@ endif
 
 all-po: $(MO_FILES)
 
-distprep: $(srcdir)/po/$(CATALOG_NAME).pot
-
 %.mo: %.po
        $(MSGFMT) -o $@ $<
 
 ifdef XGETTEXT
 ifeq ($(word 1,$(GETTEXT_FILES)),+)
-$(srcdir)/po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES))
+po/$(CATALOG_NAME).pot: $(word 2, $(GETTEXT_FILES))
        $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) -f $<
 else
-$(srcdir)/po/$(CATALOG_NAME).pot: $(GETTEXT_FILES)
+po/$(CATALOG_NAME).pot: $(GETTEXT_FILES)
 # Change to srcdir explicitly, don't rely on $^.  That way we get
 # consistent #: file references in the po files.
        $(XGETTEXT) -D $(srcdir) -n $(addprefix -k, $(GETTEXT_TRIGGERS)) $(GETTEXT_FILES)
 endif
+       @$(mkinstalldirs) $(dir $@)
        mv messages.po $@
 else # not XGETTEXT
        @echo "You don't have 'xgettext'."; exit 1
@@ -64,23 +63,23 @@ endif # not XGETTEXT
 
 
 install-po: all-po installdirs-po
+ifneq (,$(LANGUAGES))
        for lang in $(LANGUAGES); do \
-         $(INSTALL_DATA) po/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1; \
+         $(INSTALL_DATA) po/$$lang.mo '$(DESTDIR)$(localedir)'/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1; \
        done
+endif
 
 installdirs-po:
-       $(mkinstalldirs) $(foreach lang, $(LANGUAGES), $(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES)
+       $(mkinstalldirs) $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES)
 
 uninstall-po:
-       rm -f $(foreach lang, $(LANGUAGES), $(DESTDIR)$(localedir)/$(lang)/LC_MESSAGES/$(CATALOG_NAME).mo)
+       rm -f $(foreach lang, $(LANGUAGES), '$(DESTDIR)$(localedir)'/$(lang)/LC_MESSAGES/$(CATALOG_NAME).mo)
 
 
 clean-po:
        rm -f $(MO_FILES)
        @rm -f $(addsuffix .old, $(PO_FILES))
-
-maintainer-clean-po: clean-po
-       rm -f $(srcdir)/po/$(CATALOG_NAME).pot
+       rm -f po/$(CATALOG_NAME).pot
 
 
 maintainer-check-po: $(PO_FILES)
@@ -89,22 +88,25 @@ maintainer-check-po: $(PO_FILES)
        done
 
 
-init-po: $(srcdir)/po/$(CATALOG_NAME).pot
+init-po: po/$(CATALOG_NAME).pot
 
 
-update-po: $(srcdir)/po/$(CATALOG_NAME).pot
+define merge-lang
+@printf 'merging $(1) '
+@if $(MSGMERGE) $(srcdir)/po/$(1).po $< -o po/$(1).po.new $(addprefix --compendium=,$(shell find $(top_srcdir) -name $(1).po -printf '%p ')); \
+then \
+    mv $(srcdir)/po/$(1).po po/$(1).po.old; \
+    mv po/$(1).po.new $(srcdir)/po/$(1).po; \
+else \
+    echo "msgmerge for $(1) failed"; \
+    rm -f po/$(1).po.new; \
+fi
+
+endef
+
+update-po: po/$(CATALOG_NAME).pot
 ifdef MSGMERGE
-       @for lang in $(LANGUAGES); do \
-         echo "merging $$lang:"; \
-         if $(MSGMERGE) $(srcdir)/po/$$lang.po $< -o po/$$lang.po.new; \
-         then \
-           mv $(srcdir)/po/$$lang.po po/$$lang.po.old; \
-           mv po/$$lang.po.new $(srcdir)/po/$$lang.po; \
-         else \
-           echo "msgmerge for $$lang failed"; \
-           rm -f po/$$lang.po.new; \
-         fi; \
-       done
+       $(foreach lang,$(LANGUAGES),$(call merge-lang,$(lang)))
 else
        @echo "You don't have 'msgmerge'." ; exit 1
 endif
@@ -114,10 +116,9 @@ all: all-po
 install: install-po
 installdirs: installdirs-po
 uninstall: uninstall-po
-clean distclean: clean-po
-maintainer-clean: maintainer-clean-po
+clean distclean maintainer-clean: clean-po
 maintainer-check: maintainer-check-po
 
 .PHONY: all-po install-po installdirs-po uninstall-po clean-po \
-        maintainer-clean-po maintainer-check-po init-po update-po
+        maintainer-check-po init-po update-po
 .SILENT: installdirs-po