diff --git a/doc/Makefile b/doc/Makefile
index 6367e9aab6004d329ad1ec1749d3dc347fef0e86..0001055a68db8a3da6c97dbcfa4cf55f41fcb2b3 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +1,7 @@
 #
 # Makefile for the documentation directory
 #
-# Copyright 1994,2000,2010   Alessandro Rubini <rubini@linux.it>
+# Copyright 1994,2000,2010,2011   Alessandro Rubini <rubini@linux.it>
 #
 #################
 #
@@ -29,8 +29,9 @@ TEXI = $(INPUT:.in=.texi)
 .SUFFIXES: .in .texi .info .html .txt
 
 .in.texi:
-	@rm -f $@ 2> /dev/null
+	@rm -f $@
 	sed -f ./infofilter $< > $@
+	emacs -batch --no-site-file -l fixinfo $@
 	chmod -w $@
 
 # unfortuantely implicit rules are not concatenated, so force a make run
diff --git a/doc/fixinfo b/doc/fixinfo
new file mode 100644
index 0000000000000000000000000000000000000000..b7ae0ba57f9b4fcc53fcd3a97a7197aeaef88cbc
--- /dev/null
+++ b/doc/fixinfo
@@ -0,0 +1,18 @@
+
+;; use:
+;;     emacs -batch -l ./fixinfo.el <file>
+;; or, better:
+;;     emacs -batch --no-site-file -l ./fixinfo.el <file>
+
+(defun fixinfo (file)
+  (find-file-other-window file)
+  (message (concat "Maxing texinfo tree in " file))
+  (texinfo-all-menus-update)
+  (texinfo-every-node-update)
+  (save-buffer)
+  (kill-buffer (current-buffer))
+)
+
+;; loop over command line arguments
+(mapcar 'fixinfo command-line-args-left)
+(kill-emacs)