Index: gtk-doc.notmpl.make
===================================================================
--- gtk-doc.notmpl.make	(revision 488)
+++ gtk-doc.notmpl.make	(working copy)
@@ -104,9 +104,19 @@
 	rm -f *~ *.bak
 	rm -rf .libs
 
+distclean-local:
+	cd $(srcdir) && \
+	  rm -rf xml $(REPORT_FILES) \
+	         $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+	case "x $(SCAN_OPTIONS) " in \
+	  *' --rebuild-types '*) rm -f $(srcdir)/$(DOC_MODULE).types;; \
+	esac
+	case "x $(SCAN_OPTIONS) " in \
+	  *' --rebuild-sections '*) rm -f $(srcdir)/$(DOC_MODULE)-sections.txt;; \
+	esac
+
 maintainer-clean-local: clean
-	cd $(srcdir) && rm -rf xml html \
-	$(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt $(REPORT_FILES)
+	cd $(srcdir) && rm -rf html
 
 install-data-local:
 	installfiles=`echo $(srcdir)/html/*`; \
@@ -138,13 +148,16 @@
 endif
 
 dist-hook: dist-check-gtkdoc dist-hook-local
-	mkdir $(distdir)/xml
 	mkdir $(distdir)/html
-	-cp $(srcdir)/xml/*.xml $(distdir)/xml
 	cp $(srcdir)/html/* $(distdir)/html
-	if test -f $(srcdir)/$(DOC_MODULE).types; then \
-	  cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \
-	fi
+	case "x $(SCAN_OPTIONS) " in \
+	  *' --rebuild-types '*) ;; \
+	  *) cp $(srcdir)/$(DOC_MODULE).types $(distdir)/;; \
+	esac
+	case "x $(SCAN_OPTIONS) " in \
+	  *' --rebuild-sections '*) ;; \
+	  *) cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/;; \
+	esac
 	-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
 
 .PHONY : dist-hook-local docs
