diff --git a/Makefile b/Makefile
index fb540468c5865c743d1e8eba0769031c5c679e1d..be1830f1dc779dd9690cf34fe277df48cd7d7157 100644
--- a/Makefile
+++ b/Makefile
@@ -699,22 +699,4 @@ menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(di
 
 asterisk.pdf: doc/asterisk.pdf
 
-doc/asterisk.pdf: $(wildcard doc/*.tex)
-ifeq ($(findstring rubber,$(RUBBER)),)
-	@echo "**********************************************"
-	@echo "** You must install the \"rubber\" tool      ***"
-	@echo "** to generate the Asterisk reference PDF. ***"
-	@echo "**********************************************"
-else
-	@echo "**********************************************"
-	@echo "** The Asterisk reference PDF will now be  ***"
-	@echo "** generated.  When complete, it will be   ***"
-	@echo "** located at doc/asterisk.pdf.            ***"	
-	@echo "**********************************************"
-	@cp doc/asterisk.tex doc/asterisk.tex.orig
-	@sed -i -e 's/ASTERISKVERSION/$(ASTERISKVERSION)/' doc/asterisk.tex
-	@cd doc && $(RUBBER) --pdf asterisk.tex
-	@mv doc/asterisk.tex.orig doc/asterisk.tex
-endif
-
 .PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts
diff --git a/build_tools/prep_tarball b/build_tools/prep_tarball
index dbdbd46b2c78d7e789b0856d571f1fe263eca02d..d8a55be3dfd945f47e2a2973933f99a23b8e1cfc 100755
--- a/build_tools/prep_tarball
+++ b/build_tools/prep_tarball
@@ -9,4 +9,6 @@ make -C sounds all MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM MENUSELECT_MOH=MOH-
 
 make menuselect-tree
 
-cd doc && rubber --pdf asterisk.tex
+VERSION=`cat .version`
+sed -i -e "s/ASTERISKVERSION/${VERSION}/" doc/tex/asterisk.tex
+cd doc/tex && rubber --pdf asterisk.tex
diff --git a/doc/tex/Makefile b/doc/tex/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..2ccf892d33b0c893169b7398de0a5a58a8521e96
--- /dev/null
+++ b/doc/tex/Makefile
@@ -0,0 +1,35 @@
+include ../../makeopts
+
+pdf: asterisk.pdf
+
+asterisk.pdf: $(wildcard *.tex)
+ifeq ($(findstring rubber,$(RUBBER)),)
+	@echo "**********************************************"
+	@echo "** You must install the \"rubber\" tool      ***"
+	@echo "** to generate the Asterisk reference PDF. ***"
+	@echo "**********************************************"
+else
+	@echo "**********************************************"
+	@echo "** The Asterisk reference PDF will now be  ***"
+	@echo "** generated.  When complete, it will be   ***"
+	@echo "** located at asterisk.pdf.                ***"	
+	@echo "**********************************************"
+	@cp asterisk.tex asterisk.tex.orig
+	@sed -i -e 's/ASTERISKVERSION/$(ASTERISKVERSION)/' asterisk.tex
+	@$(RUBBER) --pdf asterisk.tex
+	@mv asterisk.tex.orig asterisk.tex
+endif
+
+html:
+	@echo "**********************************************"
+	@echo "** The Asterisk reference HTML will now be ***"
+	@echo "** generated.  When complete, it will be   ***"
+	@echo "** located in the asterisk/ directory.     ***"	
+	@echo "** Note that the latex2html tool is        ***"	
+	@echo "** required for this to work.              ***"	
+	@echo "**********************************************"
+	@cp asterisk.tex asterisk.tex.orig
+	@sed -i -e 's/ASTERISKVERSION/$(ASTERISKVERSION)/' asterisk.tex
+	@latex2html asterisk.tex
+	@mv asterisk.tex.orig asterisk.tex
+
diff --git a/doc/tex/README.txt b/doc/tex/README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..460d330a00773fbeef993fa5750d0fbbd3688f9e
--- /dev/null
+++ b/doc/tex/README.txt
@@ -0,0 +1,24 @@
+Asterisk Reference Documentation
+--------------------------------
+
+1) To generate a PDF from this documentation, you will need the rubber tool,
+   and all of its dependencies.  The web site for this tool is:
+
+      http://www.pps.jussieu.fr/~beffara/soft/rubber/
+
+   Then, once this tool is installed, running "make pdf" will generate
+   the PDF automatically using this tool.  The result will be asterisk.pdf.
+
+   NOTE:  After installing rubber, you will need to re-run the top level
+   configure script.  It checks to see if rubber is installed, so that the
+   asterisk.pdf Makefile target can produce a useful error message when it is
+   not installed.
+
+2) To generate HTML from this documentation, you will need the latex2html tool,
+   and all of its dependencies.  The web site for this tool is:
+
+      http://www.latex2html.org/
+
+   Then, once this tool is installed, running "make html" will generate the
+   HTML documentation.  The result will be an asterisk directory full of
+   HTML files.
diff --git a/doc/ael.tex b/doc/tex/ael.tex
similarity index 100%
rename from doc/ael.tex
rename to doc/tex/ael.tex
diff --git a/doc/ajam.tex b/doc/tex/ajam.tex
similarity index 100%
rename from doc/ajam.tex
rename to doc/tex/ajam.tex
diff --git a/doc/app-sms.tex b/doc/tex/app-sms.tex
similarity index 100%
rename from doc/app-sms.tex
rename to doc/tex/app-sms.tex
diff --git a/doc/ast_agi_commands.tex b/doc/tex/ast_agi_commands.tex
similarity index 100%
rename from doc/ast_agi_commands.tex
rename to doc/tex/ast_agi_commands.tex
diff --git a/doc/ast_appdocs.tex b/doc/tex/ast_appdocs.tex
similarity index 100%
rename from doc/ast_appdocs.tex
rename to doc/tex/ast_appdocs.tex
diff --git a/doc/ast_cli_commands.tex b/doc/tex/ast_cli_commands.tex
similarity index 100%
rename from doc/ast_cli_commands.tex
rename to doc/tex/ast_cli_commands.tex
diff --git a/doc/ast_funcdocs.tex b/doc/tex/ast_funcdocs.tex
similarity index 100%
rename from doc/ast_funcdocs.tex
rename to doc/tex/ast_funcdocs.tex
diff --git a/doc/ast_manager_actiondocs.tex b/doc/tex/ast_manager_actiondocs.tex
similarity index 100%
rename from doc/ast_manager_actiondocs.tex
rename to doc/tex/ast_manager_actiondocs.tex
diff --git a/doc/asterisk-conf.tex b/doc/tex/asterisk-conf.tex
similarity index 100%
rename from doc/asterisk-conf.tex
rename to doc/tex/asterisk-conf.tex
diff --git a/doc/asterisk.tex b/doc/tex/asterisk.tex
similarity index 98%
rename from doc/asterisk.tex
rename to doc/tex/asterisk.tex
index 10ad7f039773c6ac2cf8ffd37a354caafd302362..e6bbf3820dfdd05898bd820ff84df61306e9960a 100644
--- a/doc/asterisk.tex
+++ b/doc/tex/asterisk.tex
@@ -22,7 +22,7 @@ This document contains various pieces of information that are useful for
 reference purposes.
 
   \section{License Information}
-  \input{../LICENSE}
+  \input{../../LICENSE}
      \subsection{Hold Music}
        Digium has licensed the music included with
        the Asterisk distribution From FreePlayMusic
@@ -81,7 +81,7 @@ reference purposes.
   \section{Introduction}
   \input{dundi.tex}
   \section{Peering Agreement}
-  \input{PEERING}
+  \input{../PEERING}
 
 \chapter{ENUM}
 \input{enum.tex}
diff --git a/doc/billing.tex b/doc/tex/billing.tex
similarity index 100%
rename from doc/billing.tex
rename to doc/tex/billing.tex
diff --git a/doc/cdrdriver.tex b/doc/tex/cdrdriver.tex
similarity index 100%
rename from doc/cdrdriver.tex
rename to doc/tex/cdrdriver.tex
diff --git a/doc/chaniax.tex b/doc/tex/chaniax.tex
similarity index 100%
rename from doc/chaniax.tex
rename to doc/tex/chaniax.tex
diff --git a/doc/channelvariables.tex b/doc/tex/channelvariables.tex
similarity index 100%
rename from doc/channelvariables.tex
rename to doc/tex/channelvariables.tex
diff --git a/doc/cliprompt.tex b/doc/tex/cliprompt.tex
similarity index 100%
rename from doc/cliprompt.tex
rename to doc/tex/cliprompt.tex
diff --git a/doc/configuration.tex b/doc/tex/configuration.tex
similarity index 100%
rename from doc/configuration.tex
rename to doc/tex/configuration.tex
diff --git a/doc/dundi.tex b/doc/tex/dundi.tex
similarity index 100%
rename from doc/dundi.tex
rename to doc/tex/dundi.tex
diff --git a/doc/enum.tex b/doc/tex/enum.tex
similarity index 100%
rename from doc/enum.tex
rename to doc/tex/enum.tex
diff --git a/doc/extensions.tex b/doc/tex/extensions.tex
similarity index 100%
rename from doc/extensions.tex
rename to doc/tex/extensions.tex
diff --git a/doc/freetds.tex b/doc/tex/freetds.tex
similarity index 100%
rename from doc/freetds.tex
rename to doc/tex/freetds.tex
diff --git a/doc/hardware.tex b/doc/tex/hardware.tex
similarity index 100%
rename from doc/hardware.tex
rename to doc/tex/hardware.tex
diff --git a/doc/ices.tex b/doc/tex/ices.tex
similarity index 100%
rename from doc/ices.tex
rename to doc/tex/ices.tex
diff --git a/doc/imapstorage.tex b/doc/tex/imapstorage.tex
similarity index 100%
rename from doc/imapstorage.tex
rename to doc/tex/imapstorage.tex
diff --git a/doc/jitterbuffer.tex b/doc/tex/jitterbuffer.tex
similarity index 100%
rename from doc/jitterbuffer.tex
rename to doc/tex/jitterbuffer.tex
diff --git a/doc/localchannel.tex b/doc/tex/localchannel.tex
similarity index 100%
rename from doc/localchannel.tex
rename to doc/tex/localchannel.tex
diff --git a/doc/manager.tex b/doc/tex/manager.tex
similarity index 100%
rename from doc/manager.tex
rename to doc/tex/manager.tex
diff --git a/doc/misdn.tex b/doc/tex/misdn.tex
similarity index 100%
rename from doc/misdn.tex
rename to doc/tex/misdn.tex
diff --git a/doc/mp3.tex b/doc/tex/mp3.tex
similarity index 100%
rename from doc/mp3.tex
rename to doc/tex/mp3.tex
diff --git a/doc/odbcstorage.tex b/doc/tex/odbcstorage.tex
similarity index 100%
rename from doc/odbcstorage.tex
rename to doc/tex/odbcstorage.tex
diff --git a/doc/privacy.tex b/doc/tex/privacy.tex
similarity index 100%
rename from doc/privacy.tex
rename to doc/tex/privacy.tex
diff --git a/doc/qos.tex b/doc/tex/qos.tex
similarity index 100%
rename from doc/qos.tex
rename to doc/tex/qos.tex
diff --git a/doc/queuelog.tex b/doc/tex/queuelog.tex
similarity index 100%
rename from doc/queuelog.tex
rename to doc/tex/queuelog.tex
diff --git a/doc/queues-with-callback-members.tex b/doc/tex/queues-with-callback-members.tex
similarity index 100%
rename from doc/queues-with-callback-members.tex
rename to doc/tex/queues-with-callback-members.tex
diff --git a/doc/realtime.tex b/doc/tex/realtime.tex
similarity index 100%
rename from doc/realtime.tex
rename to doc/tex/realtime.tex
diff --git a/doc/security.tex b/doc/tex/security.tex
similarity index 100%
rename from doc/security.tex
rename to doc/tex/security.tex
diff --git a/doc/sla.tex b/doc/tex/sla.tex
similarity index 100%
rename from doc/sla.tex
rename to doc/tex/sla.tex