r7943: Add 'make manpages', fix 'make installman' and 'make uninstallman'.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 27 Jun 2005 12:09:52 +0000 (12:09 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:53 +0000 (13:18 -0500)
Not part of the "all" make target yet, as it requires xsltproc
(This used to be commit fd3f4636438cf1d9c0dd802064033271b9e4d935)

12 files changed:
source4/build/m4/check_doc.m4 [new file with mode: 0644]
source4/build/m4/env.m4
source4/build/smb_build/config_mk.pm
source4/build/smb_build/makefile.pm
source4/gtk/config.mk
source4/lib/ldb/config.mk
source4/lib/registry/config.mk
source4/lib/talloc/config.mk
source4/script/installman.sh
source4/script/uninstallman.sh
source4/torture/config.mk
source4/utils/config.mk

diff --git a/source4/build/m4/check_doc.m4 b/source4/build/m4/check_doc.m4
new file mode 100644 (file)
index 0000000..2aaf959
--- /dev/null
@@ -0,0 +1 @@
+AC_PATH_PROG(XSLTPROC, xsltproc)
index c272247661f096ca064fbb4f4b5f247ce0d4ca46..7d43f920ddb5ff074bc43bba374bbe1da5b3ee35 100644 (file)
@@ -21,3 +21,4 @@ sinclude(build/m4/check_cc.m4)
 sinclude(build/m4/check_ld.m4)
 sinclude(build/m4/check_shld.m4)
 sinclude(build/m4/check_types.m4)
+sinclude(build/m4/check_doc.m4)
index 12d62437e39860118d9f9da7bb1bfc58c2d9ad65..2194e3d5969902a08c8a4856ed2f45c3d12e5de9 100644 (file)
@@ -25,7 +25,8 @@ my %attribute_types = (
        "RELEASE_VERSION" => "string",
        "ENABLE" => "bool",
        "TARGET_CFLAGS" => "list",
-       "CMD" => "string"
+       "CMD" => "string",
+       "MANPAGE" => "string"
 );
 
 ###########################################################
index d38572e9513e8825407383760677e842fd74d766..fc4c7fd2b966e0f4683c3783cbdb4d1dff6de8c0 100644 (file)
@@ -61,17 +61,15 @@ LOCKDIR = @lockdir@
 # the directory where pid files go
 PIDDIR = @piddir@
 
-PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
-PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\"  -DSBINDIR=\"$(SBINDIR)\"
-PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" 
-PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" 
-PATH_FLAGS4 = $(PATH_FLAGS3) -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
-PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
-             -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
-PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\"
-PATH_FLAGS7 = $(PATH_FLAGS6) -DSWATDIR=\"$(SWATDIR)\"
-PATH_FLAGS = $(PATH_FLAGS7) $(PASSWD_FLAGS)
-
+MANDIR = @mandir@
+
+PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\"  -DSBINDIR=\"$(SBINDIR)\" \
+        -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
+        -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
+        -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" \
+        -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
+        -DSWATDIR=\"$(SWATDIR)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
+        -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
 __EOD__
 
        return $output;
@@ -94,6 +92,8 @@ STLD_FLAGS=-rc
 SHLD=@CC@
 SHLD_FLAGS=@LDSHFLAGS@ @LDFLAGS@ -Lbin
 
+XSLTPROC=@XSLTPROC@
+
 __EOD__
 }
 
@@ -117,7 +117,7 @@ sub _prepare_SUFFIXES($)
 
        $output = << '__EOD__';
 .SUFFIXES:
-.SUFFIXES: .c .o .h .h.gch .a .so
+.SUFFIXES: .c .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml
 
 __EOD__
 
@@ -156,6 +156,38 @@ test-noswrap: all
 __EOD__
 }
 
+sub _prepare_man_rule($)
+{
+       my $suffix = shift;
+
+       return << "__EOD__";
+.$suffix.xml.$suffix:
+       \$(XSLTPROC) -o \$@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \$<
+
+__EOD__
+}
+
+sub _prepare_manpages($)
+{
+       my $ctx = shift;
+
+       my @mp_list = ();
+
+       foreach (values %$ctx) {
+               if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "") {
+                       push (@mp_list, $_->{MANPAGE});
+               }
+       }
+       
+       my $mp = join(' ', @mp_list);
+       return << "__EOD__";
+MANPAGES = $mp
+
+manpages: \$(MANPAGES)
+
+__EOD__
+}
+
 sub _prepare_dummy_MAKEDIR()
 {
        my $ctx = shift;
@@ -534,6 +566,7 @@ realdistclean: distclean removebackup
        -rm -f include/config.h.in
        -rm -f include/version.h
        -rm -f configure
+       -rm -f $(MANPAGES)
 __EOD__
 
        return $output;
@@ -586,9 +619,10 @@ showlayout:
        @echo "  libdir:  $(LIBDIR)"
        @echo "  vardir:  $(VARDIR)"
        @echo "  privatedir:  $(PRIVATEDIR)"
-       @echo "  piddir:  $(PIDDIR)"
+       @echo "  piddir:   $(PIDDIR)"
        @echo "  lockdir:  $(LOCKDIR)"
        @echo "  swatdir:  $(SWATDIR)"
+       @echo "  mandir:   $(MANDIR)"
 
 showflags:
        @echo "Samba will be compiled with flags:"
@@ -654,6 +688,9 @@ installdat: installdirs
 installswat: installdirs
        @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
 
+installman: installdirs
+       @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
+
 uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg
 
 uninstallbin:
@@ -668,6 +705,9 @@ uninstallldb:
 uninstallreg:
        @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS)
 
+uninstallman:
+       @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
+
 # Swig extensions
 
 swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so
@@ -769,6 +809,13 @@ sub _prepare_makefile_in($$)
        $output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles");
        $output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles");
 
+       $output .= _prepare_man_rule("1");
+       $output .= _prepare_man_rule("3");
+       $output .= _prepare_man_rule("5");
+       $output .= _prepare_man_rule("7");
+
+       $output .= _prepare_manpages($CTX);
+
        $output .= _prepare_target_settings($CTX);
 
        $output .= _prepare_rule_lists($CTX);
index 34ee0315cb2ea73ef9d8d123639fd17c4cede968..e895269c153524dcebbcee07e589714ca5d92573 100644 (file)
@@ -17,6 +17,7 @@ REQUIRED_SUBSYSTEMS = CHARSET LIBBASIC EXT_LIB_gtk RPC_NDR_SAMR
 [BINARY::gregedit]
 OBJ_FILES = gtk/tools/gregedit.o
 REQUIRED_SUBSYSTEMS = CONFIG LIBCMDLINE REGISTRY GTKSMB
+MANPAGE = gtk/man/gregedit.1
 # End BINARY gregedit
 ################################################
 
index 61bd8f0152689802cdf84b1b4d9e77dfe695deae..39de5ea1c0e58deacdb96faecb0ee452b037b4d6 100644 (file)
@@ -74,6 +74,7 @@ ADD_OBJ_FILES = \
 REQUIRED_SUBSYSTEMS = \
                LIBREPLACE LIBTALLOC LDBSAMBA
 NOPROTO = YES
+MANPAGE = lib/ldb/man/man3/ldb.3
 #
 # End SUBSYSTEM LIBLDB
 ################################################
@@ -110,10 +111,11 @@ REQUIRED_SUBSYSTEMS = LIBLDB LIBCMDLINE LIBBASIC
 ################################################
 # Start BINARY ldbadd
 [BINARY::ldbadd]
-OBJ_FILES= \
+OBJ_FILES = \
                lib/ldb/tools/ldbadd.o
 REQUIRED_SUBSYSTEMS = \
                LIBLDB_CMDLINE
+MANPAGE = lib/ldb/man/man1/ldbadd.1
 # End BINARY ldbadd
 ################################################
 
@@ -124,6 +126,7 @@ OBJ_FILES= \
                lib/ldb/tools/ldbdel.o
 REQUIRED_SUBSYSTEMS = \
                LIBLDB_CMDLINE
+MANPAGE = lib/ldb/man/man1/ldbdel.1
 # End BINARY ldbdel
 ################################################
 
@@ -134,6 +137,7 @@ OBJ_FILES= \
                lib/ldb/tools/ldbmodify.o
 REQUIRED_SUBSYSTEMS = \
                LIBLDB_CMDLINE
+MANPAGE = lib/ldb/man/man1/ldbmodify.1
 # End BINARY ldbmodify
 ################################################
 
@@ -144,6 +148,7 @@ OBJ_FILES= \
                lib/ldb/tools/ldbsearch.o
 REQUIRED_SUBSYSTEMS = \
                LIBLDB_CMDLINE 
+MANPAGE = lib/ldb/man/man1/ldbsearch.1
 # End BINARY ldbsearch
 ################################################
 
@@ -154,6 +159,7 @@ OBJ_FILES= \
                lib/ldb/tools/ldbedit.o
 REQUIRED_SUBSYSTEMS = \
                LIBLDB_CMDLINE
+MANPAGE = lib/ldb/man/man1/ldbedit.1
 # End BINARY ldbedit
 ################################################
 
@@ -164,6 +170,7 @@ OBJ_FILES= \
                lib/ldb/tools/ldbrename.o
 REQUIRED_SUBSYSTEMS = \
                LIBLDB_CMDLINE
+MANPAGE = lib/ldb/man/man1/ldbrename.1
 # End BINARY ldbrename
 ################################################
 
index af9fb83bab0e90f4e91c3c8cf9159da686d5f21e..ab699a8ac0563928d88538fcdb4cb70462654b54 100644 (file)
@@ -98,6 +98,7 @@ OBJ_FILES= \
                lib/registry/tools/regdiff.o
 REQUIRED_SUBSYSTEMS = \
                CONFIG LIBCMDLINE REGISTRY
+MANPAGE = lib/registry/man/regdiff.1
 # End BINARY regdiff
 ################################################
 
@@ -108,6 +109,7 @@ OBJ_FILES= \
                lib/registry/tools/regpatch.o
 REQUIRED_SUBSYSTEMS = \
                CONFIG LIBCMDLINE REGISTRY
+MANPAGE = lib/registry/man/regpatch.1
 # End BINARY regpatch
 ################################################
 
@@ -118,6 +120,7 @@ OBJ_FILES= \
                lib/registry/tools/regshell.o
 REQUIRED_SUBSYSTEMS = \
                CONFIG LIBCMDLINE REGISTRY
+MANPAGE = lib/registry/man/regshell.1
 # End BINARY regshell
 ################################################
 
@@ -128,5 +131,6 @@ OBJ_FILES= \
                lib/registry/tools/regtree.o
 REQUIRED_SUBSYSTEMS = \
                CONFIG LIBCMDLINE REGISTRY
+MANPAGE = lib/registry/man/regtree.1
 # End BINARY regtree
 ################################################
index fe8f0e929f72e066a4929df4802dbf1a806aa67d..a1032a6e41fc9f9ba226733f5c7bdf9ddb807d24 100644 (file)
@@ -6,6 +6,7 @@ INIT_OBJ_FILES = \
 REQUIRED_SUBSYSTEMS = \
                LIBREPLACE
 NOPROTO = YES
+MANPAGE = lib/talloc/talloc.3
 #
 # End SUBSYSTEM LIBTALLOC
 ################################################
index 5b6bba69edbfb09bbe5aab2863894ffc8f4aa447..00c7114396dc4ddfa76b15f2e392f84c0cd9c1a4 100644 (file)
@@ -1,64 +1,22 @@
 #!/bin/sh
-#5 July 96 Dan.Shearer@unisa.edu.au  removed hardcoded values
-#
-# 13 Aug 2001  Rafal Szczesniak <mimir@spin.ict.pwr.wroc.pl>
-#   modified to accomodate international man pages (inspired
-#   by Japanese edition's approach)
 
 MANDIR=$1
-SRCDIR=$2/
-langs=$3
-
-if [ $# -ge 4 ] ; then
-  GROFF=$4                    # sh cmd line, including options 
-fi
-
-
-for lang in $langs; do
-    if [ "X$lang" = Xen ]; then
-       echo Installing default man pages in $MANDIR/
-       lang=.
-    else
-       echo Installing \"$lang\" man pages in $MANDIR/lang/$lang
-    fi
-
-    langdir=$MANDIR/$lang
-    for d in $MANDIR $langdir $langdir/man1 $langdir/man5 $langdir/man7 $langdir/man8; do
-       if [ ! -d $d ]; then
-           mkdir $d
-           if [ ! -d $d ]; then
-               echo Failed to make directory $d, does $USER have privileges?
-               exit 1
-           fi
+shift 1
+MANPAGES=$*
+
+for I in $MANPAGES
+do
+       SECTION=`echo $I | grep -o '.$'`
+       DIR="$MANDIR/man$SECTION"
+       if [ ! -d "$DIR" ]
+       then
+               mkdir "$DIR"
        fi
-    done
-
-    for sect in 1 5 7 8 ; do
-       for m in $langdir/man$sect ; do
-           for s in $SRCDIR../docs/manpages/$lang/*$sect; do
-           FNAME=$m/`basename $s`
-           # Test for writability.  Involves 
-           # blowing away existing files.
-           if (rm -f $FNAME && touch $FNAME); then
-               rm $FNAME
-               if [ "x$GROFF" = x ] ; then
-                   cp $s $m            # Copy raw nroff 
-               else
-                   echo "\t$FNAME"     # groff'ing can be slow, give the user
-                                       #   a warm fuzzy.
-                   $GROFF $s > $FNAME  # Process nroff, because man(1) (on
-                                       #   this system) doesn't .
-               fi
-               chmod 0644 $FNAME
-           else
-               echo Cannot create $FNAME... does $USER have privileges?
-           fi
-           done
-       done
-    done
+       
+       echo "Installing manpage \"$I\" in $DIR"
+       cp $I $DIR
 done
+
 cat << EOF
 ======================================================================
 The man pages have been installed. You may uninstall them using the command
@@ -68,4 +26,3 @@ man pages and shell scripts.
 EOF
 
 exit 0
-
index 3126709831f591f9f46332b09897964a5683f5ed..72b523ed9e88665c0ab599698128ae7d480fd645 100644 (file)
@@ -1,30 +1,20 @@
 #!/bin/sh
-#4 July 96 Dan.Shearer@UniSA.edu.au
-#
-# 13 Aug 2001  Rafal Szczesniak <mimir@spin.ict.pwr.wroc.pl>
-#   modified to accomodate international man pages (inspired
-#   by Japanese edition's approach)
-
+# 4 July 96 Dan.Shearer@UniSA.edu.au
+# Updated for Samba4 by Jelmer Vernooij
 
 MANDIR=$1
-SRCDIR=$2
-langs=$3
-
-for lang in $langs; do
-  echo Uninstalling \"$lang\" man pages from $MANDIR/$lang
+shift 1
+MANPAGES=$*
 
-  for sect in 1 5 7 8 ; do
-    for m in $MANDIR/$lang/man$sect ; do
-      for s in $SRCDIR/../docs/manpages/$lang/*$sect; do
-        FNAME=$m/`basename $s`
+for I in $MANPAGES
+do
+       SECTION=`echo $I | grep -o '.$'`
+       FNAME=$MANDIR/man$SECTION/$I
        if test -f $FNAME; then
          echo Deleting $FNAME
          rm -f $FNAME 
          test -f $FNAME && echo Cannot remove $FNAME... does $USER have privileges?   
-        fi
-      done
-    done
-  done
+    fi
 done
 
 cat << EOF
index f574b0277f44eaa4f1e05f41bc54cf47589cb1a7..fa15f692b6f3cac186e0a97c848296d4cd39badd 100644 (file)
@@ -224,6 +224,7 @@ REQUIRED_SUBSYSTEMS = \
                CONFIG \
                LIBCMDLINE \
                LIBBASIC
+MANPAGE = torture/man/smbtorture.1
 # End BINARY smbtorture
 #################################
 
@@ -239,6 +240,7 @@ REQUIRED_SUBSYSTEMS = \
                LIBBASIC \
                LIBCMDLINE \
                RPC
+MANPAGE = torture/man/gentest.1
 # End BINARY gentest
 #################################
 
@@ -253,6 +255,7 @@ REQUIRED_SUBSYSTEMS = \
                LIBBASIC \
                LIBCMDLINE \
                RPC
+MANPAGE = torture/man/masktest.1
 # End BINARY masktest
 #################################
 
@@ -268,5 +271,6 @@ REQUIRED_SUBSYSTEMS = \
                LIBBASIC \
                LIBCMDLINE \
                RPC
+MANPAGE = torture/man/locktest.1
 # End BINARY locktest
 #################################
index 1854042d65a6d1f8c820487944530cba9438c333..1af174e94eef349fe83f6076aa78d6d045457bd7 100644 (file)
@@ -11,6 +11,7 @@ REQUIRED_SUBSYSTEMS = \
                LIBBASIC \
                NDR_ALL \
                RPC
+MANPAGE = utils/man/ndrdump.1
 # FIXME: ndrdump shouldn't have to depend on RPC...
 # End BINARY ndrdump
 #################################
@@ -26,6 +27,7 @@ REQUIRED_SUBSYSTEMS = \
                LIBBASIC \
                LIBSMB \
                RPC
+MANPAGE = utils/man/ntlm_auth.1
 # End BINARY ntlm_auth
 #################################