|
Packit |
908522 |
## Copyright (c) 2009, 2011 Openismus GmbH <http://www.openismus.com/>
|
|
Packit |
908522 |
##
|
|
Packit |
908522 |
## This file is part of mm-common.
|
|
Packit |
908522 |
##
|
|
Packit |
908522 |
## mm-common is free software: you can redistribute it and/or modify
|
|
Packit |
908522 |
## it under the terms of the GNU General Public License as published
|
|
Packit |
908522 |
## by the Free Software Foundation, either version 2 of the License,
|
|
Packit |
908522 |
## or (at your option) any later version.
|
|
Packit |
908522 |
##
|
|
Packit |
908522 |
## mm-common is distributed in the hope that it will be useful,
|
|
Packit |
908522 |
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
908522 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
908522 |
## GNU General Public License for more details.
|
|
Packit |
908522 |
##
|
|
Packit |
908522 |
## You should have received a copy of the GNU General Public License
|
|
Packit |
908522 |
## along with mm-common. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
908522 |
|
|
Packit |
908522 |
## Parameters: book_name
|
|
Packit |
908522 |
## Overrides: doc_outdir, doc_config, book_title, htmlref_patterns,
|
|
Packit |
908522 |
## doc_postprocess, doc_install, tagfile_to_devhelp2,
|
|
Packit |
908522 |
## doxytagfile, devhelpfile
|
|
Packit |
908522 |
## Files: doc_input
|
|
Packit |
908522 |
## Output: dist_noinst_DATA, DISTCLEANFILES, MAINTAINERCLEANFILES
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The name of the sub-directory where the generated documentation
|
|
Packit |
908522 |
# will be placed.
|
|
Packit |
908522 |
doc_outdir ?= reference
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The name of the Doxygen configuration file.
|
|
Packit |
908522 |
doc_config ?= $(doc_outdir)/Doxyfile
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The title of the generated Devhelp book.
|
|
Packit |
908522 |
book_title ?= $(PACKAGE_NAME) Reference Manual
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# A list of wildcard patterns matching the files from the HTML directory
|
|
Packit |
908522 |
# generated by Doxygen which should be distributed and installed.
|
|
Packit |
908522 |
htmlref_patterns ?= $(addprefix $(doc_outdir)/html/*.,css gif html js png)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Locations of utilities shipped with glibmm. Made overridable
|
|
Packit |
908522 |
# in case the installed utilities cannot be used for some reason.
|
|
Packit |
908522 |
doc_postprocess ?= $(PERL) -- "$(MMDOCTOOLDIR)/doc-postprocess.pl"
|
|
Packit |
908522 |
doc_install ?= $(PERL) -- "$(MMDOCTOOLDIR)/doc-install.pl"
|
|
Packit |
908522 |
tagfile_to_devhelp2 ?= "$(MMDOCTOOLDIR)/tagfile-to-devhelp2.xsl"
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Names of the main output files.
|
|
Packit |
908522 |
doxytagfile ?= $(doc_outdir)/$(book_name).tag
|
|
Packit |
908522 |
devhelpfile ?= $(doc_outdir)/$(book_name).devhelp2
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Function: $(call vpath_listall,PATTERN ...)
|
|
Packit |
908522 |
# Get all filenames which match a PATTERN from the list. Look for files
|
|
Packit |
908522 |
# relative to either the current directory or $(srcdir). Strip $(srcdir)/
|
|
Packit |
908522 |
# again before returning and remove any duplicates.
|
|
Packit |
908522 |
vpath_srclist = $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(1))))
|
|
Packit |
908522 |
vpath_listall = $(sort $(wildcard $(1)) $(if $(srcdir:.=),$(vpath_srclist)))
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Installation directories.
|
|
Packit |
908522 |
libdocdir = $(datarootdir)/doc/$(book_name)
|
|
Packit |
908522 |
referencedir = $(libdocdir)/reference
|
|
Packit |
908522 |
htmlrefdir = $(referencedir)/html
|
|
Packit |
908522 |
devhelpdir = $(datadir)/devhelp/books/$(book_name)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Optionally, the documentation utilities may be included in source tarballs
|
|
Packit |
908522 |
# so that mm-common is only required when building in maintainer mode.
|
|
Packit |
908522 |
if DIST_DOCTOOLS
|
|
Packit |
908522 |
doctools_dist_files = $(addprefix $(MMDOCTOOLDIR)/,doc-postprocess.pl doc-install.pl tagfile-to-devhelp2.xsl doxygen-extra.css)
|
|
Packit |
908522 |
else
|
|
Packit |
908522 |
doctools_dist_files =
|
|
Packit |
908522 |
endif
|
|
Packit |
908522 |
|
|
Packit |
908522 |
if ENABLE_DOCUMENTATION
|
|
Packit |
908522 |
doc_build_files = $(doxytagfile) $(devhelpfile)
|
|
Packit |
908522 |
doc_inst_targets = install-htmlref install-devhelp
|
|
Packit |
908522 |
doc_inst_files = $(doxytagfile)
|
|
Packit |
908522 |
doc_dist_files = $(devhelpfile) $(call vpath_listall,$(htmlref_patterns))
|
|
Packit |
908522 |
else
|
|
Packit |
908522 |
doc_build_files =
|
|
Packit |
908522 |
doc_inst_targets =
|
|
Packit |
908522 |
doc_inst_files =
|
|
Packit |
908522 |
doc_dist_files =
|
|
Packit |
908522 |
endif
|
|
Packit |
908522 |
|
|
Packit |
908522 |
dist_reference_DATA = $(strip $(doc_inst_files))
|
|
Packit |
908522 |
dist_noinst_DATA = $(strip $(doctools_dist_files) $(doc_dist_files))
|
|
Packit |
908522 |
|
|
Packit |
908522 |
DISTCLEANFILES = $(doc_outdir)/doxygen.log
|
|
Packit |
908522 |
MAINTAINERCLEANFILES = $(doxytagfile) $(devhelpfile) $(doc_outdir)/html/*
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The generic bit of the doc-install.pl command line.
|
|
Packit |
908522 |
doc_install_cmd = $(doc_install) --verbose --mode=0644
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Transform $(datarootdir) into a URI to match MM_ARG_WITH_TAGFILE_DOC().
|
|
Packit |
908522 |
datarootdir_esc = $(subst $(subst ,, ),%20,$(subst \,/,$(datarootdir)))
|
|
Packit |
908522 |
docdir_base_uri = file:///$(patsubst /%,%,$(datarootdir_esc:/=))/doc
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The command and options used to install the files from the HTML reference
|
|
Packit |
908522 |
# documentation. The $(subst) magic translates external tag references from
|
|
Packit |
908522 |
# absolute to relative paths if the destination is on the local file system
|
|
Packit |
908522 |
# and installed under the same prefix as the package being built.
|
|
Packit |
908522 |
htmlref_relinst = $(subst @$(docdir_base_uri)/,@../../../,$(DOCINSTALL_FLAGS))
|
|
Packit |
908522 |
htmlref_install = $(doc_install_cmd) $(htmlref_relinst)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The command and options used to install the Devhelp file.
|
|
Packit |
908522 |
devhelp_install = $(doc_install_cmd) --book-base='$(htmlrefdir:/=)'
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Helper variables to replicate each pattern with a $(srcdir)/ prefix.
|
|
Packit |
908522 |
# Also add quoting to prevent the shell from expanding the patterns.
|
|
Packit |
908522 |
htmlref_patterns_dup = $(foreach item,$(htmlref_patterns),'$(item)' '$(srcdir)/$(item)')
|
|
Packit |
908522 |
htmlref_patterns_quote = $(patsubst %,'%',$(htmlref_patterns))
|
|
Packit |
908522 |
htmlref_patterns_vpath = $(if $(srcdir:.=),$(htmlref_patterns_dup),$(htmlref_patterns_quote))
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Expand to a list of -name 'PATTERN' arguments for use with 'find'.
|
|
Packit |
908522 |
htmlref_find_patterns = $(patsubst %,-name '%' -o,$(notdir $(htmlref_patterns))) -false
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# The parameters to the Doxygen-to-Devhelp XSLT script
|
|
Packit |
908522 |
dh_xsl_params = --stringparam book_title '$(book_title)' \
|
|
Packit |
908522 |
--stringparam book_name '$(book_name)' \
|
|
Packit |
908522 |
--stringparam book_base html
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Generated configuration files which, when updated, should cause the
|
|
Packit |
908522 |
# reference documentation to be rebuilt.
|
|
Packit |
908522 |
doc_config_deps = $(CONFIG_HEADER) $(srcdir)/$(doc_config).in $(srcdir)/Makefile.in
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Regenerate the documentation automatically only in maintainer mode.
|
|
Packit |
908522 |
# Depend on the generated configuration header files to trigger a rebuild
|
|
Packit |
908522 |
# if a configuration value changed. The configuration header files only
|
|
Packit |
908522 |
# have their timestamp modified when the content actually changed, which
|
|
Packit |
908522 |
# is not the case for any other files generated by configure.
|
|
Packit |
908522 |
if MAINTAINER_MODE
|
|
Packit |
908522 |
doc_dependencies = $(doc_config_deps) $(doc_input)
|
|
Packit |
908522 |
else
|
|
Packit |
908522 |
doc_dependencies =
|
|
Packit |
908522 |
endif
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Export this variable for use in the Doxygen configuration file.
|
|
Packit |
908522 |
export MMDOCTOOLDIR
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Depend on files that we know shall be built.
|
|
Packit |
908522 |
# $(call vpath_listall,$(htmlref_patterns)) is not used as a prerequisite.
|
|
Packit |
908522 |
# It would expand to files that exist when the make command is issued,
|
|
Packit |
908522 |
# which is not necessarily the set of files that shall be built.
|
|
Packit |
908522 |
all-local: $(doc_build_files)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Hook up custom rules for translating references to external documentation
|
|
Packit |
908522 |
# to the actual location at install time.
|
|
Packit |
908522 |
install-data-local: $(doc_inst_targets)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Hook up corresponding custom uninstall rules.
|
|
Packit |
908522 |
uninstall-local: $(addprefix un,$(doc_inst_targets))
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Install the HTML reference documentation files with just one invocation
|
|
Packit |
908522 |
# of doc-install.pl to speed up the build process. Make use of the --glob
|
|
Packit |
908522 |
# option, which tells it to perform filename globbing itself, like 'find'.
|
|
Packit |
908522 |
# This helps to avoid excessively long command lines, as some platforms
|
|
Packit |
908522 |
# have rather restrictive limits.
|
|
Packit |
908522 |
install-htmlref: $(doc_outdir)/html/index.html
|
|
Packit |
908522 |
@$(NORMAL_INSTALL)
|
|
Packit |
908522 |
$(MKDIR_P) '$(DESTDIR)$(htmlrefdir)'
|
|
Packit |
908522 |
$(htmlref_install) -t '$(DESTDIR)$(htmlrefdir)' --glob -- $(htmlref_patterns_vpath)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Delete files from the html installation directory. Avoid recursive
|
|
Packit |
908522 |
# directory removal, and apply the same wildcard pattern as was used to
|
|
Packit |
908522 |
# select files for installation.
|
|
Packit |
908522 |
uninstall-htmlref:
|
|
Packit |
908522 |
@$(NORMAL_UNINSTALL)
|
|
Packit |
908522 |
(cd '$(DESTDIR)$(htmlrefdir)' 2>/dev/null || exit 0; \
|
|
Packit |
908522 |
find . -type f '(' $(htmlref_find_patterns) ')' -exec rm -f '{}' '+')
|
|
Packit |
908522 |
-test ! -r '$(DESTDIR)$(htmlrefdir)' || rmdir '$(DESTDIR)$(htmlrefdir)'
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Install the Devhelp file, translating the base path on the fly.
|
|
Packit |
908522 |
install-devhelp: $(devhelpfile)
|
|
Packit |
908522 |
@$(NORMAL_INSTALL)
|
|
Packit |
908522 |
$(MKDIR_P) '$(DESTDIR)$(devhelpdir)'
|
|
Packit |
908522 |
$(devhelp_install) -t '$(DESTDIR)$(devhelpdir)' -- $^
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Remove the installed Devhelp file and directory.
|
|
Packit |
908522 |
uninstall-devhelp:
|
|
Packit |
908522 |
@$(NORMAL_UNINSTALL)
|
|
Packit |
908522 |
rm -f '$(DESTDIR)$(devhelpdir)/$(notdir $(devhelpfile))'
|
|
Packit |
908522 |
-test ! -r '$(DESTDIR)$(devhelpdir)' || rmdir '$(DESTDIR)$(devhelpdir)'
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Regenerate the Doxygen configuration file automatically. In the
|
|
Packit |
908522 |
# top-level build directory Automake already takes care of this.
|
|
Packit |
908522 |
ifneq ($(subdir),.)
|
|
Packit |
908522 |
$(doc_config): $(srcdir)/$(doc_config).in $(top_builddir)/config.status
|
|
Packit |
908522 |
$(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
|
Packit |
908522 |
|
|
Packit |
908522 |
endif
|
|
Packit |
908522 |
# Make sure that the documentation will always have been generated before
|
|
Packit |
908522 |
# executing commands of a rule that depends on files in $(doc_outdir)/html/.
|
|
Packit |
908522 |
$(doc_outdir)/html/%: | $(doxytagfile)
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Run Doxygen to build the reference documentation. The generated tag file
|
|
Packit |
908522 |
# also functions as time stamp target for the documentation as a whole.
|
|
Packit |
908522 |
$(doxytagfile): $(doc_dependencies) | $(doc_config)
|
|
Packit |
908522 |
-$(AM_V_at)rm -f $@
|
|
Packit |
908522 |
-$(AM_V_at)rm -fr $(doc_outdir)/html
|
|
Packit |
908522 |
$(AM_V_GEN)(echo '@INCLUDE =' $(doc_config) && echo 'INPUT =' $(doc_input)) | "$(DOXYGEN)" -
|
|
Packit |
908522 |
$(AM_V_at)$(doc_postprocess) '$(doc_outdir)/html/*.html'
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Run XSL transformation to generate a Devhelp book from a Doxygen tag file.
|
|
Packit |
908522 |
%.devhelp2: %.tag
|
|
Packit |
908522 |
$(AM_V_GEN)$(XSLTPROC) $(dh_xsl_params) -o $@ $(tagfile_to_devhelp2) $<
|
|
Packit |
908522 |
|
|
Packit |
908522 |
.PHONY: install-htmlref uninstall-htmlref install-devhelp uninstall-devhelp
|
|
Packit |
908522 |
|
|
Packit |
908522 |
# Instruct GNU make to delete the targets of a rule after it failed, in
|
|
Packit |
908522 |
# order to avoid the complication of handling that situation manually.
|
|
Packit |
908522 |
.DELETE_ON_ERROR:
|