aboutsummaryrefslogtreecommitdiffstats
path: root/docs/mk
diff options
context:
space:
mode:
Diffstat (limited to 'docs/mk')
-rw-r--r--docs/mk/api.mk205
-rw-r--r--docs/mk/common.defs.mk119
-rw-r--r--docs/mk/common.rules.mk54
-rw-r--r--docs/mk/main.mk239
4 files changed, 617 insertions, 0 deletions
diff --git a/docs/mk/api.mk b/docs/mk/api.mk
new file mode 100644
index 0000000..74cd2db
--- /dev/null
+++ b/docs/mk/api.mk
@@ -0,0 +1,205 @@
+##===- docs/mk/api.mk --------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+#
+# Generated API documentation support module.
+#
+# The following variables must be defined before including this makefile:
+#
+# API.Project formal project name. eg. LLVM or Clang.
+# API.project filesystem project name. eg. llvm or clang.
+# API.srcdir top-most source dir used in doxygen .cfg file.
+#
+##===----------------------------------------------------------------------===##
+
+include $(LLVM_SRC_ROOT)/docs/mk/common.defs.mk
+
+API.in/ = $(PROJ_SRC_DIR)/
+API.out/ = ./
+
+API.html/ = $(API.out/)html/api/
+API.html.tar = $(API.out/)html-api.tar.gz
+
+API.doxygen = $(DOXYGEN)
+API.doxygen.target = $(API.html/)index.html
+API.doxygen.extradeps = $(foreach x,html xml h,$(wildcard $(API.in/)*.$(x)))
+API.doxygen.cfg = $(API.out/)doxygen.cfg
+API.doxygen.cfg.srcdir = $(API.srcdir)
+API.doxygen.cfg.objdir = .
+API.doxygen.cfg.output_dir = $(API.out/)
+API.doxygen.cfg.dot = # blank and doxygen will search path for 'dot'
+API.doxygen.cfg.opts = $(call SELECT,API.doxygen.cfg.opts,$(HOST_OS))
+API.doxygen.cfg.opts.__.Darwin = DOT_FONTNAME=Monaco DOT_FONTSIZE=8
+API.doxygen.cfg.opts.__.Linux = DOT_FONTNAME=FreeSans DOT_FONTSIZE=9
+API.doxygen.cfg.opts.__.default = # values from file
+API.doxygen.cfg.version = $(call fn.SVN.LCREV,$(API.srcdir))
+
+API.doxygen.css = $(API.html/)api.css \
+ $(API.html/)api.ie.css
+
+ifdef VERBOSE
+API.doxygen.cfg.opts := QUIET=NO WARN_IF_DOC_ERROR=YES $(API.doxygen.cfg.opts)
+endif
+
+API.files += $(API.html.tar)
+API.files += $(API.doxygen.cfg)
+API.files += $(API.doxygen.css)
+API.files += $(API.doxygen.target)
+
+DOCS.mkdir.files += $(API.files)
+
+##===----------------------------------------------------------------------===##
+
+INSTALL.out/ = $(PROJ_prefix)/share/
+INSTALL.doc/ = $(INSTALL.out/)doc/$(API.project)/
+
+INSTALL.html/ = $(INSTALL.doc/)html/api/
+INSTALL.html.target = $(API.doxygen.target:$(API.html/)%=$(INSTALL.html/)%)
+INSTALL.html.tar = $(INSTALL.doc/)$(notdir $(API.html.tar))
+
+INSTALL.files += $(INSTALL.html.tar)
+
+DOCS.mkdir.files += $(INSTALL.doc/)file-placebo
+DOCS.mkdir.files += $(INSTALL.files)
+
+##===----------------------------------------------------------------------===##
+
+clean-local::
+ -$(Verb) $(RM) -f $(API.files)
+ -$(Verb) $(call fn.RMRF,$(API.html/))
+
+ifeq ($(ENABLE_DOXYGEN),1)
+all:: docs docs-tar
+install-local:: install-docs
+uninstall-local:: uninstall-docs
+endif
+
+##===----------------------------------------------------------------------===##
+
+.PHONY: docs-tar
+docs-tar: $(API.html.tar)
+
+.PHONY: docs
+docs: $(API.doxygen.target)
+
+$(API.html.tar): | $(dir $(API.html.tar))
+$(API.html.tar): $(API.doxygen.target)
+ $(Echo) Creating $(API.Project) API documentation tarball
+ $(Verb) (set -e; cd $(API.out/); \
+ $(TAR) cf - --exclude='*.md5' --exclude='*.map' html/api) \
+ $(call fn.PIPE.COMP,$@) > $@
+
+$(API.doxygen.cfg): | $(dir $(API.doxygen.cfg))
+$(API.doxygen.cfg): $(notdir $(API.doxygen.cfg)).in
+ $(Echo) Generating $(API.Project) doxygen config
+ $(Verb) $(CAT) $< | $(SED) \
+ -e 's,@srcdir@,$(API.doxygen.cfg.srcdir),g' \
+ -e 's,@objdir@,$(API.doxygen.cfg.objdir),g' \
+ -e 's,@output_dir@,$(API.doxygen.cfg.output_dir),g' \
+ -e 's,@dot@,$(API.doxygen.cfg.dot),g' \
+ -e 's,@version@,$(API.doxygen.cfg.version),g' \
+ > $@
+
+$(API.html/)api.css: | $(dir $(API.html/)api.css)
+$(API.html/)api.css: api.css
+ $(Echo) Copying $(API.Project) doxygen stylesheet
+ $(Verb) $(CP) $< $@
+
+# IE misbehaves when browser-specific constructs are used.
+# This target strips them out to create an IE-specific css file.
+# The following is an example of setting background to an extension.
+# With IE instead of skipping an unrecognized extension it resets
+# the background:
+#
+# background: -webkit-gradient(...)
+#
+# Note this simple approach assumes source has strippable single-lines.
+#
+$(API.html/)api.ie.css: | $(dir $(API.html/)api.ie.css)
+$(API.html/)api.ie.css: api.css
+ $(Echo) Generating $(API.Project) doxygen stylesheet for IE
+ $(Verb) $(CAT) $< | egrep -v -e '-(moz|webkit)' > $@
+
+# Generate API docs.
+#
+# Define API.nodot=1 to not use 'dot' tool even if available.
+# In this mode doxygen has built-in support to generate only class-diagrams
+# and thus all other diagrams are skipped. Shaves 80% off generate time.
+#
+# We pipe (doxygen.cfg + overrides) to doxygen. This allows us to override
+# almost any setting in doxygen.cfg file without having to edit it.
+#
+ifneq (undefined,$(origin API.nodot))
+$(API.doxygen.target): API.doxygen.cfg.opts += HAVE_DOT=NO
+$(API.doxygen.target): API.doxygen.target.msg = " (FAST)"
+endif
+$(API.doxygen.target): | $(dir $(API.doxygen.target))
+$(API.doxygen.target): $(API.doxygen.cfg)
+$(API.doxygen.target): $(API.doxygen.css)
+$(API.doxygen.target): $(API.doxygen.extradeps)
+ $(Echo) Generating $(API.Project) API documentation$(API.doxygen.target.msg)
+ $(Verb) ($(CAT) $(API.doxygen.cfg)$(foreach n,$(API.doxygen.cfg.opts),; echo '$n')) | \
+ $(API.doxygen) -
+
+##===----------------------------------------------------------------------===##
+
+.PHONY: install-docs
+install-docs: $(INSTALL.html.tar)
+install-docs: $(INSTALL.html.target)
+
+$(INSTALL.html.target): | $(INSTALL.doc/)
+$(INSTALL.html.target): $(API.html.tar)
+ $(Echo) Installing $(API.Project) API documentation
+ $(Verb) $(CAT) $(API.html.tar) $(call fn.PIPE.DECOMP,$(API.html.tar)) | \
+ (set -e; cd $(INSTALL.doc/); $(TAR) xf -)
+ @touch $@
+
+$(INSTALL.html.tar): | $(dir $(INSTALL.html.tar))
+$(INSTALL.html.tar): $(API.html.tar)
+ $(Echo) Installing $(API.Project) API documentation tarball
+ $(Verb) $(DataInstall) $< $@
+
+uninstall-docs:
+ $(Echo) Uninstalling $(API.Project) API documentation
+ -$(Verb) $(RM) -f $(INSTALL.files)
+ -$(Verb) $(call fn.RMRF,$(INSTALL.html/))
+
+##===----------------------------------------------------------------------===##
+
+DOCS.vars.mandatory += API.Project API.project API.srcdir
+DOCS.vars.print += $(sort $(filter INSTALL.%/,$(.VARIABLES)))
+
+HELP.sections += API.help
+
+define API.help
+ API Documentation Module. This module is srcdir/objdir build-friendly.
+
+ WARNING: The following directories are recursively deleted during cleanup
+ procedures. Be sure not to mix files therein or bad things will happen.
+
+ $(API.html/)
+ $(INSTALL.html/)
+
+ ------------------------------------------------------------------------------
+ TARGET NOTES
+ ------------------------------------------------------------------------------
+ *all invokes target docs
+ *install invokes target install-docs
+ *uninstall invokes target uninstall-docs
+ ------------------------------------------------------------------------------
+ docs generate API docs from sources using doxygen
+ ------------------------------------------------------------------------------
+ docs-tar create docs tarball $(API.html.tar)
+ clean remove built files
+ install-docs install to $(INSTALL.doc/)
+ uninstall-docs remove installed files
+ ------------------------------------------------------------------------------
+ (targets marked with '*' require configure --enable-doxygen)
+endef
+
+include $(LLVM_SRC_ROOT)/docs/mk/common.rules.mk
diff --git a/docs/mk/common.defs.mk b/docs/mk/common.defs.mk
new file mode 100644
index 0000000..5e57e24
--- /dev/null
+++ b/docs/mk/common.defs.mk
@@ -0,0 +1,119 @@
+##===- docs/mk/common.defs.mk ------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+# support for printing errors, warnings and info.
+
+# FUNCTION: print error message once and dump makefile list.
+# $1: error message. do NOT end in punctuation.
+# $2: optional. one or more words to list. if words > 1 then 1 per line.
+define fn.DUMP.error
+$(if $(filter 0,$(words $2)) \
+ ,$(error $(call _DUMP.error,$1.)) \
+ ,$(if $(filter 1,$(words $2)) \
+ ,$(error $(call _DUMP.error,$1: $2)) \
+ ,$(error $(call _DUMP.errorm,$1:,$2))))
+endef
+
+# FUNCTION: print one error message per word and dump makefile list.
+# $1: error message. do NOT end in punctuation.
+# $2: one or more words to list. 1 word per line.
+define fn.DUMP.errorn
+$(error $(call _DUMP.errorn,$1,$2))
+endef
+
+##===----------------------------------------------------------------------===##
+
+# MAKEFILE PRIVATE.
+# support for special makefile printing. Whitespace is very important for all
+# definitions; modify with caution.
+
+define _DUMP.error
+ERROR.
+***
+*** $1
+***
+$(call _DUMP.makefile_list,***,$1) ERROR
+endef
+
+define _DUMP.errorm
+ERROR.
+***
+*** $1
+***$(subst *** ,***,$(foreach n,$2, $n$(_TEXT.blank)***))
+$(call _DUMP.makefile_list,***,$1) ERROR
+endef
+
+define _DUMP.errorn
+ERROR.
+***
+***$(subst *** ,***,$(foreach n,$2, ERROR: $1: $n$(_TEXT.blank)***))
+$(call _DUMP.makefile_list,***,$1) ERROR
+endef
+
+define _DUMP.makefile_list
+$1 MAKEFILE_LIST:
+$1 $(abspath $(word 1,$(MAKEFILE_LIST)))
+$1$(subst $()$1 ,$1,$(foreach n,$(wordlist 2,999,$(MAKEFILE_LIST)), $n$(_TEXT.blank)$1))
+$1
+endef
+
+# force linefeed.
+define _TEXT.blank
+
+
+endef
+
+##===----------------------------------------------------------------------===##
+
+# FUNCTION: select
+# $1: variable basename (before .__.)
+# $2: selection key
+# RESULT: variable selection by key
+#
+SELECT = $(if $($1.__.$2),$($1.__.$2),$($1.__.default))
+
+# FUNCTION: safe(r) rm -rf
+# $1: list of dirs to remove, recursively
+#
+# Extra safety is put in place by wrapping dirs in $(realpath) which both cleans
+# up the path and returns blank if the path does not exist.
+#
+# An error is produced if removal of any generally unsafe dirs is attempted.
+#
+fn.RMRF = $(if $(call _RMRF.eval,$1) \
+ ,$(call fn.DUMP.errorn,unsafe recursive dir removal in call function fn.RMRF,$(call _RMRF.eval,$1)) \
+ ,$(RM) -rf $(realpath $1))
+
+_RMRF.eval = $(sort $(realpath $(filter $(realpath $(_RMRF.never)),$(realpath $1))))
+
+_RMRF.never = / /bin /dev /etc /home /net /opt /sbin /tmp /usr /var \
+ /usr/bin /usr/sbin /usr/share \
+ /usr/local/bin /usr/local/sbin /usr/local/share
+
+# FUNCTION: pipe and compress.
+# $1: target filename with filename extension of compression, if any.
+# RESULT: a suitable pipe for compression or empty.
+#
+fn.PIPE.COMP = $(fn.PIPE.COMP.$(suffix $1))
+fn.PIPE.COMP..gz = | $(GZIP)
+fn.PIPE.COMP..bz2 = | $(BZIP2)
+
+# FUNCTION: pipe and decompress.
+# $1: target filename with filename extension of compression, if any.
+# RESULT: a suitable pipe for decompression or empty.
+#
+fn.PIPE.DECOMP = $(fn.PIPE.DECOMP.$(suffix $1))
+fn.PIPE.DECOMP..gz = | $(GZIP) -d
+fn.PIPE.DECOMP..bz2 = | $(BZIP2) -d
+
+# FUNCTION: fetch working copy 'Last Changed Rev'.
+# $1: working copy directory.
+# RESULT: 'Last Changed Rev' value from svn info.
+#
+fn.SVN.LCREV = $(shell (svn info $1 2>/dev/null || echo "Last Changed Rev: 0") | $(SED) -n 's/^Last Changed Rev: *\([0-9][0-9]*\)/\1/p')
diff --git a/docs/mk/common.rules.mk b/docs/mk/common.rules.mk
new file mode 100644
index 0000000..698f433
--- /dev/null
+++ b/docs/mk/common.rules.mk
@@ -0,0 +1,54 @@
+##===- docs/mk/common.rules.mk -----------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+# Emit an error for any missing variables which are required to be defined
+# before including this makefile-module.
+#
+_DOCS.vars.missing := $(foreach v,$(DOCS.vars.mandatory),$(if $($v),,$v))
+
+ifneq (,$(strip $(_DOCS.vars.missing)))
+$(call fn.DUMP.errorn,undefined variable,$(_DOCS.vars.missing))
+endif
+
+##===----------------------------------------------------------------------===##
+
+# Basic target to build directory of output files.
+# Opaque file lists not visible to target rules need not be added here.
+#
+$(sort $(dir $(DOCS.mkdir.files))):
+ $(Echo) Creating directory $(@:$(PROJ_OBJ_ROOT)/%=%)
+ $(Verb) $(MKDIR) $@
+
+##===----------------------------------------------------------------------===##
+
+# Print help defined by variables added to the help list.
+#
+.PHONY:
+help:
+ $(foreach h,$(HELP.sections),$(info $())$(info $($h)))
+ $(info $())
+
+##===----------------------------------------------------------------------===##
+
+printvars:: $(DOCS.vars.mandatory:%=%.print.var)
+printvars:: $(DOCS.vars.print:%=%.print.var)
+
+.PHONY: %.printvar
+%.print.var:
+ @echo '$($*)' | awk -v name='$*' '{ printf("llvm[$(MAKELEVEL)]: %-13s: %s\n",name,$$0) }'
+
+##===----------------------------------------------------------------------===##
+
+.PHONY: vars
+vars: $(sort $(foreach n,$(filter-out \
+ .VARIABLES $(HELP.sections) HELP.%,$(.VARIABLES)),$n.print2.var))
+
+.PHONY: %.print2.var
+%.print2.var:
+ @echo "$* = $($*)"
diff --git a/docs/mk/main.mk b/docs/mk/main.mk
new file mode 100644
index 0000000..f11a47f
--- /dev/null
+++ b/docs/mk/main.mk
@@ -0,0 +1,239 @@
+##===- docs/mk/main.mk -------------------------------------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+#
+# Main HTML documentation support module.
+#
+# The following variables must be defined before including this makefile:
+#
+# HTML.Project formal project name. eg. LLVM or Clang.
+# HTML.project filesystem project name. eg. llvm or clang.
+#
+##===----------------------------------------------------------------------===##
+
+include $(LLVM_SRC_ROOT)/docs/mk/common.defs.mk
+
+MAIN.in/ = $(PROJ_SRC_DIR)/
+MAIN.out/ = ./
+
+MAIN.html/ = $(MAIN.out/)html/
+MAIN.html.tar = $(MAIN.out/)html.tar.gz
+MAIN.html.cp.ext = .html .css .txt .png .jpg .gif
+MAIN.html.cp.in = $(patsubst $(MAIN.in/)%,%, \
+ $(sort $(wildcard $(foreach x,$(MAIN.html.cp.ext), $(MAIN.in/)*$(x) ))) \
+ $(sort $(wildcard $(foreach x,$(MAIN.html.cp.ext), $(MAIN.in/)*/*$(x) ))) \
+ $(sort $(wildcard $(foreach x,$(MAIN.html.cp.ext), $(MAIN.in/)*/*/*$(x) ))) )
+MAIN.html.cp.out = $(MAIN.html.cp.in:%=$(MAIN.html/)%)
+MAIN.html.pod.in = $(patsubst $(MAIN.in/)%,%, \
+ $(sort $(wildcard $(MAIN.in/)*.pod )) \
+ $(sort $(wildcard $(MAIN.in/)*.pod )) \
+ $(sort $(wildcard $(MAIN.in/)*/*.pod )) \
+ $(sort $(wildcard $(MAIN.in/)*/*/*.pod )) )
+MAIN.html.pod.out = $(MAIN.html.pod.in:%.pod=$(MAIN.html/)%.html)
+
+MAIN.html.files = $(MAIN.html.cp.out) \
+ $(MAIN.html.pod.out)
+
+MAIN.man/ = $(MAIN.out/)man/man1/
+MAIN.man.in = $(sort $(wildcard $(MAIN.in/)*.pod )) \
+ $(sort $(wildcard $(MAIN.in/)*/*.pod )) \
+ $(sort $(wildcard $(MAIN.in/)*/*/*.pod ))
+MAIN.man.out = $(patsubst %.pod,$(MAIN.man/)%.1,$(notdir $(MAIN.man.in)))
+
+MAIN.ps/ = $(MAIN.out/)ps/
+MAIN.ps.out = $(patsubst %.1,$(MAIN.ps/)%.ps,$(notdir $(MAIN.man.out)))
+
+MAIN.pdf/ = $(MAIN.out/)pdf/
+MAIN.pdf.out = $(patsubst %.1,$(MAIN.pdf/)%.pdf,$(notdir $(MAIN.man.out)))
+
+MAIN.files += $(MAIN.html.tar)
+MAIN.files += $(MAIN.html.cp.out)
+MAIN.files += $(MAIN.html.pod.out)
+MAIN.files += $(MAIN.man.out)
+MAIN.files += $(MAIN.ps.out)
+MAIN.files += $(MAIN.pdf.out)
+
+DOCS.mkdir.files += $(MAIN.files)
+
+##===----------------------------------------------------------------------===##
+
+INSTALL.out/ = $(PROJ_prefix)/share/
+INSTALL.doc/ = $(INSTALL.out/)doc/$(MAIN.project)/
+
+INSTALL.html/ = $(INSTALL.doc/)html/
+INSTALL.html.tar = $(INSTALL.doc/)$(notdir $(MAIN.html.tar))
+INSTALL.html.out = $(MAIN.html.files:$(MAIN.html/)%=$(INSTALL.html/)%)
+
+INSTALL.man/ = $(PROJ_mandir)/man1/
+INSTALL.man.out = $(MAIN.man.out:$(MAIN.man/)%=$(INSTALL.man/)%)
+
+INSTALL.ps/ = $(INSTALL.doc/)ps/
+INSTALL.ps.out = $(MAIN.ps.out:$(MAIN.ps/)%=$(INSTALL.ps/)%)
+
+INSTALL.pdf/ = $(INSTALL.doc/)pdf/
+INSTALL.pdf.out = $(MAIN.pdf.out:$(MAIN.pdf/)%=$(INSTALL.pdf/)%)
+
+INSTALL.files += $(INSTALL.html.tar)
+INSTALL.files += $(INSTALL.html.out)
+INSTALL.files += $(INSTALL.man.out)
+INSTALL.files += $(INSTALL.ps.out)
+INSTALL.files += $(INSTALL.pdf.out)
+
+DOCS.mkdir.files += $(INSTALL.out/)file-placebo
+DOCS.mkdir.files += $(INSTALL.files)
+
+##===----------------------------------------------------------------------===##
+
+clean-local::
+ -$(Verb) $(RM) -f $(MAIN.files)
+
+all:: docs docs-tar
+install-local:: install-docs
+uninstall-local:: uninstall-docs
+
+##===----------------------------------------------------------------------===##
+
+.PHONY: docs-tar
+docs-tar: $(MAIN.html.tar)
+
+.PHONY: docs
+docs: $(MAIN.html.files)
+docs: $(MAIN.man.out)
+ifneq (,$(GROFF))
+docs: $(MAIN.ps.out)
+endif
+ifneq (,$(PDFROFF))
+docs: $(MAIN.pdf.out)
+endif
+
+$(MAIN.html.tar): | $(dir $(MAIN.html.tar))
+$(MAIN.html.tar): $(MAIN.html.files)
+ $(Echo) Creating $(MAIN.Project) MAIN documentation tarball
+ $(Verb) (set -e; cd $(MAIN.out/); $(TAR) cf - html) \
+ $(call fn.PIPE.COMP,$@) > $@
+
+$(MAIN.html.cp.out): | $(dir $(MAIN.html.cp.out))
+$(MAIN.html.cp.out): $(MAIN.html/)%: %
+ $(Echo) Copying to $(@:$(PROJ_OBJ_ROOT)/%=%)
+ $(Verb) $(CP) $< $@
+
+$(MAIN.html.pod.out): | $(dir $(MAIN.html.pod.out))
+$(MAIN.html.pod.out): $(MAIN.html/)%.html: %.pod
+ $(Echo) Converting pod to $(@:$(PROJ_OBJ_ROOT)/%=%)
+ $(Verb) $(CAT) $< | (set -e; cd $(MAIN.in/); $(POD2HTML) --title=$(*F) \
+ --noindex --css=manpage.css \
+ --htmlroot=. --podpath=. --podroot=$(<D)) > $@
+
+$(MAIN.man.out): | $(dir $(MAIN.man.out))
+$(MAIN.man.out): $(MAIN.man/)%.1: %.pod
+ $(Echo) Converting pod to $(@:$(PROJ_OBJ_ROOT)/%=%)
+ $(Verb) $(POD2MAN) --release=$(PROJ_VERSION) --center="$(MAIN.man.center)" $< $@
+
+$(MAIN.ps.out): | $(dir $(MAIN.ps.out))
+$(MAIN.ps.out): $(MAIN.ps/)%.ps: $(MAIN.man/)%.1
+ $(Echo) Converting man to $(@:$(PROJ_OBJ_ROOT)/%=%)
+ $(Verb) $(GROFF) -Tps -man $< > $@
+
+$(MAIN.pdf.out): | $(dir $(MAIN.pdf.out))
+$(MAIN.pdf.out): $(MAIN.pdf/)%.pdf: $(MAIN.man/)%.1
+ $(Echo) Converting man to $(@:$(PROJ_OBJ_ROOT)/%=%)
+ $(Verb) $(PDFROFF) -man --no-toc-relocation $< > $@
+
+# Mapping of src pod files is not always direct so we need a search vpath.
+# This solution works because no man page filenames (without dir) collide.
+vpath %.pod $(sort $(dir $(MAIN.man.in)))
+
+##===----------------------------------------------------------------------===##
+
+.PHONY: install-docs
+install-docs: $(INSTALL.html.tar)
+install-docs: $(INSTALL.html.out)
+install-docs: $(INSTALL.man.out)
+ifneq (,$(GROFF))
+install-docs: $(INSTALL.ps.out)
+endif
+ifneq (,$(PDFROFF))
+install-docs: $(INSTALL.pdf.out)
+endif
+
+$(INSTALL.html.tar): | $(dir $(INSTALL.html.tar))
+$(INSTALL.html.tar): $(MAIN.html.tar)
+ $(Echo) Installing $(MAIN.Project) MAIN documentation tarball
+ $(Verb) $(DataInstall) $< $@
+
+$(INSTALL.html.out): | $(dir $(INSTALL.html.out))
+$(INSTALL.html.out): $(INSTALL.html/)%: $(MAIN.html/)%
+ $(Echo) Installing $(@:$(INSTALL.out/)%=%)
+ $(Verb) $(DataInstall) $< $@
+
+$(INSTALL.man.out): | $(dir $(INSTALL.man.out))
+$(INSTALL.man.out): $(INSTALL.man/)%: $(MAIN.man/)%
+ $(Echo) Installing $(@:$(INSTALL.out/)%=%)
+ $(Verb) $(DataInstall) $< $@
+
+$(INSTALL.ps.out): | $(dir $(INSTALL.ps.out))
+$(INSTALL.ps.out): $(INSTALL.ps/)%: $(MAIN.ps/)%
+ $(Echo) Installing $(@:$(INSTALL.out/)%=%)
+ $(Verb) $(DataInstall) $< $@
+
+$(INSTALL.pdf.out): | $(dir $(INSTALL.pdf.out))
+$(INSTALL.pdf.out): $(INSTALL.pdf/)%: $(MAIN.pdf/)%
+ $(Echo) Installing $(@:$(INSTALL.out/)%=%)
+ $(Verb) $(DataInstall) $< $@
+
+uninstall-docs:
+ $(Echo) Uninstalling $(MAIN.Project) MAIN documentation
+ -$(Verb) $(RM) -f $(INSTALL.files)
+
+##===----------------------------------------------------------------------===##
+
+DOCS.vars.mandatory += MAIN.Project MAIN.project MAIN.man.center
+DOCS.vars.print += $(sort $(filter INSTALL.%/,$(.VARIABLES)))
+
+HELP.sections += MAIN.help
+
+define MAIN.help
+ MAIN Documentation Module. This module is objdir build-friendly.
+
+ ------------------------------------------------------------------------------
+ TARGET NOTES
+ ------------------------------------------------------------------------------
+ *all invokes target docs
+ *install invokes target install-docs
+ *uninstall invokes target uninstall-docs
+ ------------------------------------------------------------------------------
+ docs copy MAIN docs from
+ $(MAIN.in/)
+ with extensions { $(MAIN.html.cp.ext) }
+
+ and perform conversions:
+
+ FROM TO DESTINATION
+ --------------------------------------------------------------
+ html -> html $(MAIN.html/)
+ pod -> man $(MAIN.man/)
+ man -> ps $(MAIN.ps/)
+ man -> pdf $(MAIN.pdf/)
+ ------------------------------------------------------------------------------
+ docs-tar create docs tarball $(MAIN.html.tar)
+ clean remove built files
+ install-docs install MAIN docs:
+
+ FROM TO DESTINATION
+ --------------------------------------------------------------
+ html -> html $(INSTALL.html/)
+ pod -> man $(INSTALL.man/)
+ man -> ps $(INSTALL.ps/)
+ man -> pdf $(INSTALL.pdf/)
+ ------------------------------------------------------------------------------
+ uninstall-docs remove installed files
+ ------------------------------------------------------------------------------
+ (targets marked with '*' require configure --enable-doxygen)
+endef
+
+include $(LLVM_SRC_ROOT)/docs/mk/common.rules.mk