diff --git a/doc/Makefile.am b/doc/Makefile.am
index a504d8f1576e636e4d5fbb4f496262b9e923810d..aa0d33a79fb02c0bc333a0da1328ea6fdf24a6c4 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.40 2002/01/01 14:47:58 ceder Exp $
+# $Id: Makefile.am,v 1.41 2002/03/29 19:19:32 ceder Exp $
 # Copyright (C) 1998-1999, 2001  Lysator Academic Computer Association.
 #
 # This file is part of the LysKOM server.
@@ -36,6 +36,10 @@ EXTRA_DIST = .cvsignore \
 	cmsltt12.mf \
 	constructs.expected
 
+# Automake does not yet support these targets automatically.
+pdf: Protocol-A.pdf
+html: protocol-a/index.html protocol-a.html
+
 # Automake tries to generate this rule automatically, but it fails
 # because of the capital letters in the file name of the source file.
 protocol-a.info: Protocol-A.texi
@@ -43,17 +47,51 @@ protocol-a.info: Protocol-A.texi
 	cd $(srcdir) \
 	  && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
 
+# The TeX implementation cannot cope with Protocol-A.texi.  We use too
+# many macros in too complex ways.  But if we expand a few of them
+# with a simple sed-script, texinfo.tex will do a fair job.
+# Unfortunately, this means that the automake magic fails, so we
+# disable it with a explicit targets for the dvi and pdf output.
+
+Protocol-A.dvi: protocol-a.texi
+	TEXINPUTS="../scripts:$$TEXINPUTS" \
+	MAKEINFO='makeinfo -I .' \
+	texi2dvi protocol-a.texi
+	mv protocol-a.dvi $@
+
+Protocol-A.pdf: protocol-a.texi
+	TEXINPUTS="../scripts:$$TEXINPUTS" \
+	MAKEINFO='makeinfo -I .' \
+	texi2dvi --pdf protocol-a.texi
+	mv protocol-a.pdf $@
+
+protocol-a.texi: Protocol-A.texi
+	## This sed script works with texinfo.tex version 2002-03-26.08.
+	## With any luck, this could be replaced by a simple "cp" when
+	## a future version of texinfo.tex is created.
+	sed < $(srcdir)/Protocol-A.texi \
+	    -e 's/@holl{\([^,]*\),\([^}]*\)}/\1H\2/g' \
+	    -e 's/@value{IAM}/Inl@"a{}gg @}t mig/g' \
+	    -e 's/@lt{\([^}]*\)}/\1/g' \
+	> $@.tmp
+	chmod 444 $@.tmp
+	$(RM) $@
+	mv $@.tmp $@
+
 SUFFIXES = .texi .notab
 
 .texi.notab:
-	@# Mixing tabs and non-tabs may cause the info file to look
-	@# ugly.  Ban tabs.
+	## Mixing tabs and non-tabs may cause the info file to look
+	## ugly.  Ban tabs.
 	$(RM) $@
 	if grep -n '	' $< /dev/null ; then echo tabs detected ; exit 1; fi
 	gawk 'length($0) > 79 {print FILENAME ":" NR ": too long line"; e=1} \
 		END {exit(e)}' $<
 	echo no tabs found > $@
 
+protocol-a/index.html: Protocol-A.texi
+	makeinfo --html $(srcdir)/Protocol-A.texi
+
 protocol-a.html: Protocol-A.texi
 	makeinfo --html --no-split $(srcdir)/Protocol-A.texi
 
@@ -62,9 +100,11 @@ protocol-a.html: Protocol-A.texi
 WWWROOT=/lysator/www/www-pages/html/lyskom/protocol
 PROTOEDITION=`sed -n 's/^@set PROTOEDITION //p' < $(srcdir)/Protocol-A.texi`
 WWWREV=$(WWWROOT)/$(PROTOEDITION)
-update-www: protocol-a.info protocol-a.html # Protocol-A.dvi Protocol-A.pdf
+update-www: protocol-a.info protocol-a.html protocol-a/index.html \
+    Protocol-A.dvi Protocol-A.pdf
 	cd $(WWWROOT) || false
-	rm -rf $(WWWREV) Protocol-A-$(PROTOEDITION)-info \
+	rm -rf $(WWWREV) \
+		Protocol-A-$(PROTOEDITION)-info \
 		$(WWWROOT)/Protocol-A-$(PROTOEDITION)-info.tar \
 		$(WWWROOT)/Protocol-A-$(PROTOEDITION)-info.tar.gz
 	mkdir $(WWWREV)
@@ -75,16 +115,14 @@ update-www: protocol-a.info protocol-a.html # Protocol-A.dvi Protocol-A.pdf
 	echo Protocol-A-$(PROTOEDITION)-info.tar|(cd $(WWWROOT)&&xargs gzip -9)
 	cp $(srcdir)/Protocol-A.texi $(WWWROOT)/Protocol-A-$(PROTOEDITION).texi
 	rm -r Protocol-A-$(PROTOEDITION)-info
-	## cp Protocol-A.dvi $(WWWROOT)/Protocol-A-$(PROTOEDITION).dvi
-	## cp Protocol-A.pdf $(WWWROOT)/Protocol-A-$(PROTOEDITION).pdf
+	cp Protocol-A.dvi $(WWWROOT)/Protocol-A-$(PROTOEDITION).dvi
+	cp Protocol-A.pdf $(WWWROOT)/Protocol-A-$(PROTOEDITION).pdf
 	ln -s ../Protocol-A-$(PROTOEDITION).texi $(WWWREV)/Protocol-A.texi
 	cp protocol-a.html $(WWWREV)/protocol-a.html
+	cp protocol-a/* $(WWWREV)/
 	echo "Don't forget to edit $(WWWROOT)/index.html"
 
-Protocol-A.pdf: Protocol-A.texi
-	texi2pdf $(srcdir)/Protocol-A.texi
-
-check: check-doc
+check: check-doc pdf dvi
 
 check-doc: Protocol-A.notab lyskomd.notab info
 	## Create a list of all aux-items.