diff --git a/am/documentation b/am/documentation
index fb5ea6fb6922754b4852e473a0247ca139d56df4..16aa0cb0739cc13cff7e7866ca68cdba66221431 100644
--- a/am/documentation
+++ b/am/documentation
@@ -1,23 +1,24 @@
 # -*- Makefile -*-
 # $Id: global-rules 5267 2008-09-10 10:45:42Z christi $
 
-maintainer-clean-local: doc-clean
+maintainer-clean-local: doc-clean-am
 
 ###
 # build doc / web-install recursively
-doc-am:
+doc-clean-am: clean-am doc-clean-documentation doc-clean-local
+doc-am: doc-all-documentation doc-local
 web-install-am: web-install-local
 
 doc-local:
+doc-clean-local:
 web-install-local:
 
-doc-clean:
-	rm -f $(DOCFILES)
-
 web-install: web-install-recursive
 doc: doc-recursive
+doc-clean: doc-clean-recursive
 
 web-install-recursive \
+doc-clean-recursive \
 doc-recursive:
 	@set fnord $$MAKEFLAGS; amf=$$2; \
 	dot_seen=no; \
@@ -37,3 +38,41 @@ doc-recursive:
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
+install-data-local: install-documentation
+uninstall-local: uninstall-documentation
+
+####
+# "implementations"
+
+doc-all-documentation: $(DOCFILES)
+
+doc-clean-documentation:
+	-test -z "$(DOCFILES)" || rm -f $(DOCFILES)
+
+install-documentation: $(DOCFILES) install-documentation-local
+	@$(NORMAL_INSTALL)
+	test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
+	@list='$(DOCFILES) $(DOCFILES_EXTRA)'; test -n "$(docdir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+	done
+
+uninstall-documentation: uninstall-documentation-local
+	@$(NORMAL_UNINSTALL)
+	@list='$(DOCFILES) $(DOCFILES_EXTRA)'; test -n "$(docdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(docdir)" && rm -f $$files
+
+.PHONY: uninstall-documentation uninstall-documentation-local \
+	install-documentation install-documentation-local \
+    doc-clean-am doc-am web-install-am \
+    doc-local doc-clean-local web-install-local \
+	web-install doc doc-clean \
+	web-install-recursive doc-clean-recursive doc-recursive
diff --git a/am/doxygen b/am/doxygen
index 95ca024cacc16af51ad406bb528d7db550c2944c..b85301d97eeadef250187b2282b37e8e08aced06 100644
--- a/am/doxygen
+++ b/am/doxygen
@@ -30,10 +30,8 @@ endif # DUNEWEB
 # how to build doxygen documentation
 if BUILD_DOCS
   DOXYGENTAG = doxygen-tag
-  DOXYGEN_HTML = html 
   # EXTRAINSTALL in the html subdirectory
   DOXYGENHTMLFILES = *.html *.css *.png *.gif
-  DOXYGENDISTFILES = doxygen-tag
   DOXYGENINSTALL = $(DOXYGENHTMLFILES) ../doxygen.log ../doxyerr.log
 endif # BUILD_DOCS
 
@@ -49,63 +47,65 @@ $(srcdir)/Doxyfile.in: FORCE
 # what files does the doxygen-generated stuff depend on (find-syntax)
 DOXYGEN_DEPENDON = -name \*.cc -o -name \*.hh -o -name \*.png -o -name Doxyfile -o -name modules
 # check dependency ourself to be robust
-doxygen-tag: FORCE Doxyfile $(DOXYGENHEADER) $(DOXYGENFOOTER)
+$(DOXYGENTAG): FORCE Doxyfile $(DOXYGENHEADER) $(DOXYGENFOOTER)
 	set -e; \
-	if test ! -e doxygen-tag || test x"`find $(top_srcdir) \( $(DOXYGEN_DEPENDON) \) -a -cnewer doxygen-tag -print`" != x ; then \
+	if test ! -f "$(VPATH)/$(DOXYGENTAG)" && ( test ! -e $(DOXYGENTAG) \
+	  || test x"`find $(top_srcdir) \( $(DOXYGEN_DEPENDON) \) -a -cnewer $(DOXYGENTAG) -print`" != x ); then \
 	    echo Running doxygen. This may take a while... ; \
 	    $(DOXYGEN) Doxyfile > doxygen.log <&-; \
-	    touch doxygen-tag ; \
+	    touch $(DOXYGENTAG) ; \
 	    if test "$$DOXYQUIET" != "1" && test -f doxyerr.log; \
 	      then cat doxyerr.log; fi; \
 	    if test -x "$(DUNEWEBDOXY)/update-doxygen.css"; \
 	      then $(DUNEWEBDOXY)/update-doxygen.css $(abs_builddir)/html; fi; \
 	fi
-doc-doxygen: $(DOXYGEN_HTML) $(DOXYGENHEADER) $(DOXYGENFOOTER)
+doc-doxygen: $(DOXYGENTAG) $(DOXYGENHEADER) $(DOXYGENFOOTER)
 else
 doc-doxygen:
 endif # DOXYGEN
-doc-am: doc-doxygen
+doc-local: doc-doxygen
+
+doxygen-html-install:
+	set -e; \
+	OLDPWD=$$PWD; \
+	dir=$(abs_srcdir); \
+	if test -d $(abs_builddir)/$(DOXYGENTAG); then dir=$(abs_builddir); fi; \
+	cd "$$dir/html/"; \
+	list=`echo $(DOXYGENHTMLFILES)`; \
+	cd "$$OLDPWD"; \
+	for p in $$list; do \
+	  $(instcmd) $$dir/html/$$p $(instdir); \
+	done;
 
 ####
 # how to store doxygen in the tarball
 if DOXYGEN
-doxygen-dist-install: doxygen-tag
-	set -e;\
-	mkdir $(distdir)/html; \
-	cd $(abs_builddir)/html; \
-	list=`echo $(DOXYGENHTMLFILES)`; \
-	cd $(abs_builddir); \
-	for i in $$list; do \
-	  cp html/$$i $(distdir)/html; \
-	done;
+doxygen-dist-install: $(DOXYGENTAG)
+	set -e; mkdir $(distdir)/html; \
+	$(MAKE) doxygen-html-install instcmd="cp -fp" instdir="$(distdir)/html"
+	set -e; dir=$(abs_srcdir); \
+	if test -f $(abs_builddir)/$(DOXYGENTAG); then dir=$(abs_builddir); fi; \
+	cp $$dir/$(DOXYGENTAG) $(distdir)/$(DOXYGENTAG)
 
 dist-hook: doxygen-dist-install
 
-html: doxygen-tag
-
 endif # DOXYGEN
 
 ####
 # how to install doxygen
 if BUILD_DOCS
 
-install-doxygen-data: $(DOXYGEN_HTML)
-	$(mkinstalldirs) $(DESTDIR)/$(doxygendir); \
-	dir=$(srcdir); \
-	if test -d ./html; then dir=.; fi; echo "dir=$$dir"; \
-	list='$(DOXYGENHTMLFILES)'; \
-	for p in $$list; do \
-		$(install_sh_DATA) $$dir/html/$$p $(DESTDIR)/$(doxygendir); \
-	done
+install-doxygen: $(DOXYGENTAG)
+	set -e; $(mkinstalldirs) $(DESTDIR)/$(doxygendir); \
+	pwd; \
+	$(MAKE) doxygen-html-install instcmd="$(install_sh_DATA)" instdir="$(DESTDIR)/$(doxygendir)"
 
-uninstall-doxygen-data:
-	list='$(DOXYGENHTMLFILES)'; \
-	for p in $$list; do \
-	  rm -f $(DESTDIR)/$(doxygendir)/$$p; \
-	done
+uninstall-doxygen:
+	rm -rf $(DESTDIR)/$(doxygendir)
 
-install-data-local: install-doxygen-data
-uninstall-local: uninstall-doxygen-data
+# add doxygen to documentation-installation
+install-documentation-local: install-doxygen
+uninstall-documentation-local: uninstall-doxygen
 
 endif # BUILD_DOCS
 
@@ -124,20 +124,20 @@ web-install-doxygen:
 else
 web-install-doxygen:
 endif # DUNEWEB
-web-install-am: web-install-doxygen
+web-install-local: web-install-doxygen
 
 ####
 # how to clean the doxygen stuff
-maintainer-clean-local: doxygen-maintainer-clean
+doc-clean-local: doxygen-doc-clean
 dist-clean-local: doxygen-dist-clean
 
 doxygen-dist-clean:
-	rm -f doxygen.log doxygen-tag
+	rm -f doxygen.log doxyerr.log $(DOXYGENTAG)
 
-doxygen-maintainer-clean:
-	rm -rf $(DOXYGENTAG) $(DOXYGEN_HTML) $(DOXYGENHEADER) $(DOXYGENFOOTER) *~
+doxygen-doc-clean:
+	rm -rf html $(DOXYGENTAG) $(DOXYGENHEADER) $(DOXYGENFOOTER) *~
 	rm -f doxyerr.log doxygen.log
-	test -f Doxylocal && rm -f Doxygen.in
+	test ! -f Doxylocal || rm -f Doxygen.in
 
 # nice trick from the GNU make infopage to force a rule to run
 FORCE:
diff --git a/am/latex b/am/latex
index 1ab0bccbddd6ce2165f72be7223097676950d46f..bf4f17665b0b859dd4881958acd6c7def8ef13be 100644
--- a/am/latex
+++ b/am/latex
@@ -25,3 +25,13 @@
 
 .dvi.ps:
 	TEXINPUTS=.:$(srcdir):${TEXINPUTS}: $(DVIPS) $* -o
+
+TEXCLEANFILES = *.aux *.bbl *.blg *.log *.out *.toc *.dvi
+clean-local: latex-clean
+doc-clean-local: latex-doc-clean
+latex-clean:
+	-test -z "$(TEXCLEANFILES)" || rm -f $(TEXCLEANFILES)
+	-rm -rf auto
+
+latex-doc-clean: latex-clean
+	-rm -f *.pdf *.ps
diff --git a/am/webstuff b/am/webstuff
index 6e2fdfdd663fff69f4123b8067352c1419592dcb..d88e956b5587242b968e775b7b5721aa2df103d4 100644
--- a/am/webstuff
+++ b/am/webstuff
@@ -39,10 +39,12 @@ else
 web-install-default:
 endif
 
+####
+# how to clean up
 web-build: $(PAGES)
 web-clean:
-	rm -f $(PAGES)
+	-test -z $(PAGES) || rm -f $(PAGES)
 
-maintainer-clean-local: web-clean
-web-install-am: web-install-default
-doc-am: web-build
+doc-clean-local: web-clean
+web-install-local: web-install-default
+doc-local: web-build