changeset 9927:ecbf1577200c

Distribute DOCSTRINGS to prevent unnecessary documentation rebuild
author Rik <rdrider0-list@yahoo.com>
date Sun, 06 Dec 2009 20:40:42 -0800
parents 7ad553781c62
children 6786e1e41676
files scripts/ChangeLog scripts/Makefile.am scripts/mkdoc src/ChangeLog src/Makefile.am
diffstat 5 files changed, 35 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,12 @@
+2009-12-06  Rik <rik@nomad.inbox5.com>
+
+	* Makefile.am: Distribute DOCSTRINGS so that documentation will not require
+	rebuild after merely untarring a distribution.
+	* mkdoc: Change output to refer to mfiles as "scripts/..." rather than
+	"$srcdir/...".  Otherwise, distributed DOCSTRINGS file will not match
+	DOCSTRINGS created under a VPATH build and documentation will be
+	unnecessarily rebuilt.
+
 2009-12-05  Jaroslav Hajek  <highegg@gmail.com>
 
 	* set/ismember.m: Simplify.
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -28,6 +28,7 @@
 FCN_FILE_DIRS =
 
 EXTRA_DIST = \
+  DOCSTRINGS \
   gethelp.cc \
   mkdoc \
   mk-pkg-add
--- a/scripts/mkdoc
+++ b/scripts/mkdoc
@@ -42,24 +42,28 @@
     if [ "$arg" = "--" ]; then
       prefix=""
     else
-      echo "$prefix$arg" | $PERL -n -e 'chop;
-	$f = "$_";
-        next unless m{(.*)/(@|)([^/]*)/(.*)\.m};
-        $fcn = "$4";
-        if ($2) {
-          $fcn = "$2$3/$fcn";
-        }
-	for (qx{./gethelp $fcn "$f" < "$f"}) {
-	  s/^\s+\@/\@/ unless $i_am_in_example;
+      $PERL -w -e '
+	unless (@ARGV == 2) { die "Usage: $0 srcdir m_filename" ; }
+	($srcdir, $m_fname) = ($ARGV[0], $ARGV[1]);
+	$full_fname = $srcdir . $m_fname;
+	exit unless ( $full_fname =~ m{(.*)/(@|)([^/]*)/(.*)\.m} );
+	if ($2) {
+	  $fcn = "$2$3/$4";
+	} else {
+	  $fcn = $4;
+	}
+	$re_srcdir = quotemeta($srcdir);
+	for (qx{ ./gethelp $fcn "$full_fname" < "$full_fname"} ) {
+	  s/^\s+\@/\@/ unless $in_example;
 	  s/^\s+\@group/\@group/;
-	  s/^\s+\@end\s+group/\@end\s+group/;
-	  $i_am_in_example = 1 if /\s*\@example/;
-	  $i_am_in_example = 0 if /\s*\@end\s+example/;
+	  s/^\s+\@end\s+group/\@end group/;
+	  s|\@c $re_srcdir|\@c scripts/|o;
+	  $in_example = (/\s*\@example\b/ .. /\s*\@end\s+example\b/);
 	  print;
-	}'
+	}' "$prefix" "$arg"
     fi
   done
 else
   echo "gethelp program seems to be missing!" 1>&2
   exit 1
-fi
\ No newline at end of file
+fi
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-06  Rik <rik@nomad.inbox5.com>
+
+	* Makefile.am: Distribute DOCSTRINGS so that documentation will not require
+	rebuild after merely untarring a distribution.
+
 2009-12-05  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/lookup.cc (Flookup): Document complexity.
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,6 +72,7 @@
   ChangeLog \
   Makefile.in \
   defaults.h.in \
+  DOCSTRINGS \
   find-defun-files.sh \
   genprops.awk \
   graphics.h.in \
@@ -621,7 +622,7 @@
 
 DOCSTRINGS: gendoc$(BUILD_EXEEXT)
 	./gendoc > $@-t
-	mv $@-t $@
+	$(simple_move_if_change_rule)
 
 doc-files: $(DEF_FILES)
 	echo $(DEF_FILES) > $@-t