prepare to upload
[debian/sudo] / Makefile.in
index 6df0c07c32e01ea5c7f3ee84892732a2c7533667..1fbed4cd05b14762342247ca399ae6079ea2cb35 100644 (file)
@@ -29,11 +29,16 @@ sysconfdir = @sysconfdir@
 libexecdir = @libexecdir@
 includedir = @includedir@
 datarootdir = @datarootdir@
+localedir = @localedir@
 localstatedir = @localstatedir@
 docdir = @docdir@
 mandir = @mandir@
 timedir = @timedir@
 
+# User and group ids the installed files should be "owned" by
+install_uid = 0
+install_gid = 0
+
 # sudoers owner and mode for package building
 sudoersdir = $(sysconfdir)
 sudoers_uid = @SUDOERS_UID@
@@ -42,7 +47,7 @@ sudoers_mode = @SUDOERS_MODE@
 
 SUBDIRS = compat common @ZLIB_SRC@ plugins/sudoers src include doc
 
-SAMPLES = plugins/sample plugins/sample_group
+SAMPLES = plugins/sample plugins/sample_group plugins/system_group
 
 VERSION = @PACKAGE_VERSION@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
@@ -51,6 +56,25 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
 
 SHELL = @SHELL@
 
+INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
+
+ECHO_N = @ECHO_N@
+ECHO_C = @ECHO_C@
+
+# Message catalog support
+NLS = @SUDO_NLS@
+POTFILES = src/po/sudo.pot plugins/sudoers/po/sudoers.pot
+MSGFMT = msgfmt
+MSGMERGE = msgmerge
+XGETTEXT = xgettext
+XGETTEXT_OPTS = -F -k_ -kN_ --copyright-holder="Todd C. Miller" \
+               "--msgid-bugs-address=http://www.sudo.ws/bugs" \
+               --package-name=@PACKAGE_NAME@ --package-version=$(VERSION) \
+               --flag warning:1:c-format --flag warningx:1:c-format \
+               --flag error:2:c-format --flag errorx:2:c-format \
+               --flag easprintf:3:c-format --flag lbuf_append:2:c-format \
+               --flag lbuf_append_quoted:3:c-format --foreign-user
+
 all: config.status
        for d in $(SUBDIRS) $(SAMPLES); \
            do (cd $$d && exec $(MAKE) $@) && continue; \
@@ -63,25 +87,64 @@ check pre-install: config.status
            exit $$?; \
        done
 
-install-dirs install-binaries install-includes install-plugin uninstall: config.status pre-install
+install-dirs install-binaries install-includes install-plugin: config.status pre-install
+       for d in $(SUBDIRS); \
+           do (cd $$d && exec $(MAKE) $@) && continue; \
+           exit $$?; \
+       done
+
+install-doc: config.status ChangeLog
+       for d in $(SUBDIRS); \
+           do (cd $$d && exec $(MAKE) $@) && continue; \
+           exit $$?; \
+       done
+
+install: config.status ChangeLog pre-install install-nls
        for d in $(SUBDIRS); \
            do (cd $$d && exec $(MAKE) $@) && continue; \
            exit $$?; \
        done
 
-install install-doc: config.status ChangeLog pre-install
+uninstall: uninstall-nls
        for d in $(SUBDIRS); \
            do (cd $$d && exec $(MAKE) $@) && continue; \
            exit $$?; \
        done
 
+uninstall-nls:
+       for pot in $(POTFILES); do \
+           domain=`basename $$pot .pot`; \
+           rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/$$domain.mo; \
+       done
+
 autoconf:
        autoconf -I m4
 
-# The 1.8 branch started February 25, 2011
+siglist.c:
+       (cd compat && exec $(MAKE) $@)
+
+depend: siglist.c
+       @if test "$(srcdir)" != "."; then \
+           echo "make depend only supported in the source directory"; \
+           exit 1; \
+       fi; \
+       $(srcdir)/mkdep.pl $(srcdir)/common/Makefile.in \
+           $(srcdir)/compat/Makefile.in $(srcdir)/plugins/sample/Makefile.in \
+           $(srcdir)/plugins/sample_group/Makefile.in \
+           $(srcdir)/plugins/sudoers/Makefile.in \
+           $(srcdir)/plugins/system_group/Makefile.in \
+           $(srcdir)/src/Makefile.in $(srcdir)/zlib/Makefile.in; \
+       ./config.status --file $(srcdir)/common/Makefile \
+           --file $(srcdir)/compat/Makefile \
+           --file $(srcdir)/plugins/sample/Makefile \
+           --file $(srcdir)/plugins/sample_group/Makefile \
+           --file $(srcdir)/plugins/sudoers/Makefile \
+           --file $(srcdir)/plugins/system_group/Makefile \
+           --file $(srcdir)/src/Makefile --file $(srcdir)/zlib/Makefile
+
 ChangeLog:
        if test -d $(srcdir)/.hg && cd $(srcdir); then \
-           if hg log --style=changelog -b 1.8 > $@.tmp && hg log --style=changelog -b default --date '<2011-02-25 21:30:00' >> $@.tmp; then \
+           if hg log --style=changelog -b default > $@.tmp; then \
                mv -f $@.tmp $@; \
            else \
                rm -f $@.tmp; \
@@ -100,7 +163,94 @@ libtool: $(LIBTOOL_DEPS)
 Makefile: $(srcdir)/Makefile.in
        ./config.status --file Makefile
 
-dist: ChangeLog $(srcdir)/MANIFEST
+sync-po: rsync-po compile-po
+
+rsync-po:
+       rsync -Lrtvz  translationproject.org::tp/latest/sudo/ src/po/
+       rsync -Lrtvz  translationproject.org::tp/latest/sudoers/ plugins/sudoers/po/
+
+update-pot:
+       @if $(XGETTEXT) --help >/dev/null 2>&1; then \
+           cd $(top_srcdir); \
+           for pot in $(POTFILES); do \
+               echo "Updating $$pot"; \
+               domain=`basename $$pot .pot`; \
+               case "$$domain" in \
+                   sudo) cfiles="src/*c common/*c compat/*c";; \
+                   sudoers) cfiles="plugins/sudoers/*.c plugins/sudoers/auth/*.c";; \
+                   *) echo unknown domain $$domain; continue;; \
+               esac; \
+               $(XGETTEXT) $(XGETTEXT_OPTS) -d$$domain $$cfiles -o $$pot.tmp; \
+               if diff -I'^.POT-Creation-Date' -I'^.Project-Id-Version' -I'^#' $$pot.tmp $$pot >/dev/null; then \
+                   rm -f $$pot.tmp; \
+               else \
+                   mv -f $$pot.tmp $$pot; \
+               fi; \
+           done; \
+       fi
+
+update-po: update-pot
+       @if $(MSGFMT) --help >/dev/null 2>&1; then \
+           cd $(top_srcdir); \
+           for pot in $(POTFILES); do \
+               podir=`dirname $$pot`; \
+               for po in $$podir/*.po; do \
+                   echo $(ECHO_N) "Updating $$po$(ECHO_C)"; \
+                   $(MSGMERGE) --update $$po $$pot; \
+                   $(MSGFMT) --output /dev/null --check-format $$po || exit 1; \
+               done; \
+           done; \
+       fi
+
+compile-po:
+       @if $(MSGFMT) --help >/dev/null 2>&1; then \
+           cd $(top_srcdir); \
+           rm -f Makefile.$$$$; \
+           POFILES=""; \
+           for pot in $(POTFILES); do \
+               podir=`dirname $$pot`; \
+               for po in $$podir/*.po; do \
+                   POFILES="$$POFILES $$po"; \
+               done; \
+           done; \
+           echo "all: `echo $$POFILES | sed 's/\.po/.mo/g'`" >> Makefile.$$$$; \
+           echo "" >> Makefile.$$$$; \
+           for po in $$POFILES; do \
+               mo=`echo $$po | sed 's/po$$/mo/'`; \
+               echo "$$mo: $$po" >> Makefile.$$$$; \
+               echo "  $(MSGFMT) --statistics -c -o $$mo $$po" >> Makefile.$$$$; \
+           done; \
+           make -f Makefile.$$$$; \
+           rm -f Makefile.$$$$; \
+       fi
+
+install-nls:
+       @if test "$(NLS)" = "enabled"; then \
+           cd $(top_srcdir); \
+           for pot in $(POTFILES); do \
+               podir=`dirname $$pot`; \
+               domain=`basename $$pot .pot`; \
+               SUDO_LINGUAS=$${LINGUAS-"`echo $$podir/*.mo|sed 's:'$$podir'/\([^ ]*\).mo:\1:g'`"}; \
+               echo $(ECHO_N) "Installing $$domain message catalogs:$(ECHO_C)"; \
+               for lang in $$SUDO_LINGUAS; do \
+                   test -s $$podir/$$lang.mo || continue; \
+                   echo $(ECHO_N) " $$lang$(ECHO_C)"; \
+                   $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
+                   $(INSTALL) -O $(install_uid) -G $(install_gid) -m 0444 $$podir/$$lang.mo $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$domain.mo; \
+               done; \
+               echo ""; \
+           done; \
+       fi
+
+check-dist: update-pot compile-po
+       @if [ -d .hg ]; then \
+           if hg stat -am | grep '\.[mp]ot*$$'; then \
+               echo "Uncommitted message catalog changes" 1>&2; \
+               false; \
+           fi; \
+       fi
+
+dist: check-dist ChangeLog $(srcdir)/MANIFEST
        pax -w -x ustar -s '/^/$(PACKAGE_TARNAME)-$(VERSION)\//' \
            -f ../$(PACKAGE_TARNAME)-$(VERSION).tar \
            `sed 's/[   ].*//' $(srcdir)/MANIFEST`
@@ -119,6 +269,7 @@ package: sudo.pp
            includedir=$(includedir) \
            timedir=$(timedir) \
            mandir=$(mandir) \
+           localedir=$(localedir) \
            docdir=$(docdir) \
            sysconfdir=$(sysconfdir) \
            sudoersdir=$(sudoersdir) \