Overhauled llvm/clang docs builds. Closes PR6613.

NOTE: 2nd part changeset for cfe trunk to follow.

*** PRE-PATCH ISSUES ADDRESSED

- clang api docs fail build from objdir
- clang/llvm api docs collide in install PREFIX/
- clang/llvm main docs collide in install
- clang/llvm main docs have full of hard coded destination
  assumptions and make use of absolute root in static html files;
  namely CommandGuide tools hard codes a website destination
  for cross references and some html cross references assume
  website root paths

*** IMPROVEMENTS

- bumped Doxygen from 1.4.x -> 1.6.3
- splits llvm/clang docs into 'main' and 'api' (doxygen) build trees
- provide consistent, reliable doc builds for both main+api docs
- support buid vs. install vs. website intentions
- support objdir builds
- document targets with 'make help'
- correct clean and uninstall operations
- use recursive dir delete only where absolutely necessary
- added call function fn.RMRF which safeguards against botched 'rm -rf';
  if any target (or any variable is evaluated) which attempts
  to remove any dirs which match a hard-coded 'safelist', a verbose
  error will be printed and make will error-stop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103213 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/Makefile b/docs/Makefile
index 8f7d617..a0fdfe3 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -7,117 +7,7 @@
 # 
 ##===----------------------------------------------------------------------===##
 
-LEVEL      := ..
-DIRS       := CommandGuide tutorial
-
-ifdef BUILD_FOR_WEBSITE
-PROJ_OBJ_DIR = .
-DOXYGEN = doxygen
-
-$(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
-	cat $< | sed \
-	  -e 's/@abs_top_srcdir@/../g' \
-	  -e 's/@DOT@/dot/g' \
-	  -e 's/@PACKAGE_VERSION@/mainline/' \
-	  -e 's/@abs_top_builddir@/../g' > $@
-endif
+LEVEL = ..
+DIRS  = main api
 
 include $(LEVEL)/Makefile.common
-
-HTML       := $(wildcard $(PROJ_SRC_DIR)/*.html) \
-              $(wildcard $(PROJ_SRC_DIR)/*.css)
-IMAGES     := $(wildcard $(PROJ_SRC_DIR)/img/*.*)
-DOXYFILES  := doxygen.cfg.in doxygen.css doxygen.footer doxygen.header \
-              doxygen.intro
-EXTRA_DIST := $(HTML) $(DOXYFILES) llvm.css CommandGuide img
-
-.PHONY: install-html install-doxygen doxygen install-ocamldoc ocamldoc generated
-
-install_targets := install-html
-ifeq ($(ENABLE_DOXYGEN),1)
-install_targets += install-doxygen
-endif
-ifneq (,$(filter ocaml,$(BINDINGS_TO_BUILD)))
-install_targets += install-ocamldoc
-endif
-install-local:: $(install_targets)
-
-# Live documentation is generated for the web site using this target:
-# 'make generated BUILD_FOR_WEBSITE=1'
-generated:: doxygen ocamldoc
-
-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
-	$(Echo) Installing HTML documentation
-	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
-	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
-	$(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
-	$(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
-
-$(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
-	$(Echo) Packaging HTML documentation
-	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/html.tar
-	$(Verb) cd $(PROJ_SRC_DIR) && \
-	  $(TAR) cf $(PROJ_OBJ_DIR)/html.tar *.html
-	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/html.tar
-
-install-doxygen: doxygen
-	$(Echo) Installing doxygen documentation
-	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
-	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
-	  $(FIND) . -type f -exec \
-	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
-
-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
-
-regendoc:
-	$(Echo) Building doxygen documentation
-	$(Verb) if test -e $(PROJ_OBJ_DIR)/doxygen ; then \
-	  $(RM) -rf $(PROJ_OBJ_DIR)/doxygen ; \
-	fi
-	$(Verb) $(DOXYGEN) $(PROJ_OBJ_DIR)/doxygen.cfg
-
-$(PROJ_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(PROJ_OBJ_DIR)/doxygen.cfg
-	$(Echo) Packaging doxygen documentation
-	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/doxygen.tar
-	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/doxygen.tar doxygen
-	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/doxygen.tar
-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_OBJ_DIR)/doxygen/html/
-
-userloc: $(LLVM_SRC_ROOT)/docs/userloc.html
-
-$(LLVM_SRC_ROOT)/docs/userloc.html:
-	$(Echo) Making User LOC Table
-	$(Verb) cd $(LLVM_SRC_ROOT) ; ./utils/userloc.pl -details -recurse \
-	  -html lib include tools runtime utils examples autoconf test > docs/userloc.html
-
-install-ocamldoc: ocamldoc
-	$(Echo) Installing ocamldoc documentation
-	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
-	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
-	  $(FIND) . -type f -exec \
-	    $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
-
-ocamldoc: regen-ocamldoc
-	$(Echo) Packaging ocamldoc documentation
-	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
-	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
-	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar
-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
-
-regen-ocamldoc:
-	$(Echo) Building ocamldoc documentation
-	$(Verb) if test -e $(PROJ_OBJ_DIR)/ocamldoc ; then \
-		$(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc ; \
-	fi
-	$(Verb) $(MAKE) -C $(LEVEL)/bindings/ocaml ocamldoc
-	$(Verb) $(MKDIR) $(PROJ_OBJ_DIR)/ocamldoc/html
-	$(Verb) \
-		$(OCAMLDOC) -d $(PROJ_OBJ_DIR)/ocamldoc/html -sort -colorize-code -html \
-		`$(FIND) $(LEVEL)/bindings/ocaml -name "*.odoc" -exec echo -load '{}' ';'`
-
-uninstall-local::
-	$(Echo) Uninstalling Documentation
-	$(Verb) $(RM) -rf $(DESTDIR)$(PROJ_docsdir)