* Adjust so this falls in line with LLVM Makefile standards.
* Implement installation of doxygen and html documentation
* Fix it so it works with objdir != srcdir.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18318 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/docs/CommandGuide/Makefile b/docs/CommandGuide/Makefile
index e6cd3ea..cb1f3ec 100644
--- a/docs/CommandGuide/Makefile
+++ b/docs/CommandGuide/Makefile
@@ -1,23 +1,60 @@
-POD = $(wildcard *.pod)
-HTML = $(patsubst %.pod, html/%.html, $(POD))
-MAN = $(patsubst %.pod, man/man1/%.1, $(POD))
-PS = $(patsubst %.pod, ps/%.ps, $(POD))
+##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file was developed by the LLVM research group and is distributed under
+# the University of Illinois Open Source License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
 
-all: $(HTML) $(MAN) $(PS)
+LEVEL := ../..
+
+include $(LEVEL)/Makefile.common
+
+POD := $(wildcard $(BUILD_SRC_DIR)/*.pod)
+
+EXTRA_DIST := $(POD) index.html
+
+HTML = $(patsubst $(BUILD_SRC_DIR)/%.pod, html/%.html, $(POD))
+MAN = $(patsubst $(BUILD_SRC_DIR)/%.pod, man/man1/%.1, $(POD))
+PS = $(patsubst $(BUILD_SRC_DIR)/%.pod, ps/%.ps, $(POD))
+
+all-local:: $(HTML) $(MAN) $(PS)
 
 .SUFFIXES:
 .SUFFIXES: .html .pod .1 .ps
 
+$(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir
+
 html/%.html: %.pod
-	pod2html --css=manpage.css --htmlroot=. \
-		--podpath=. --noindex --infile=$< --outfile=$@
+	$(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \
+	  --noindex --infile=$< --outfile=$@ --title=$*
 
 man/man1/%.1: %.pod
-	pod2man --release=1.4 --center="LLVM Command Guide" $< $@
+	$(POD2MAN) --release=$(PACKAGE_VERSION) \
+	  --center="LLVM Command Guide" $< $@
 
 ps/%.ps: man/man1/%.1
-	groff -Tps -man $< > $@
+	$(GROFF) -Tps -man $< > $@
 
-clean:
-	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
+clean-local::
+	$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
 
+install-local:: $(HTML) $(MAN) $(PS)
+	$(Echo) Installing HTML CommandGuide Documentation
+	$(Verb) $(INSTALL) -d $(LLVM_DOCSDIR)/html/CommandGuide
+	$(Verb) $(INSTALL) -C $(HTML) $(LLVM_DOCSDIR)/html/CommandGuide
+	$(Echo) Installing MAN CommandGuide Documentation
+	$(Verb) $(INSTALL) -d $(LLVM_MANDIR)/man1
+	$(Verb) $(INSTALL) -C $(MAN) $(LLVM_MANDIR)/man1
+	$(Echo) Installing PS CommandGuide Documentation
+	$(Verb) $(INSTALL) -d $(LLVM_DOCSDIR)/ps
+	$(Verb) $(INSTALL) -C $(PS) $(LLVM_DOCSDIR)/ps
+
+uninstall-local::
+	$(Echo) Uninstalling Documentation
+	$(Verb) $(RM) -rf $(LLVM_DOCSDIR)
+
+printvars::
+	$(Echo) "POD            : " '$(POD)'
+	$(Echo) "HTML           : " '$(HTML)'