~ubuntu-branches/ubuntu/saucy/atkmm1.6/saucy-proposed

« back to all changes in this revision

Viewing changes to build/doc-reference.am

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2010-11-02 20:35:53 UTC
  • Revision ID: james.westby@ubuntu.com-20101102203553-syno2w6yedmcdgk8
ImportĀ upstreamĀ versionĀ 2.22.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Copyright (c) 2009  Openismus GmbH  <http://www.openismus.com/>
 
2
##
 
3
## This file is part of mm-common.
 
4
##
 
5
## mm-common is free software: you can redistribute it and/or modify
 
6
## it under the terms of the GNU General Public License as published
 
7
## by the Free Software Foundation, either version 2 of the License,
 
8
## or (at your option) any later version.
 
9
##
 
10
## mm-common is distributed in the hope that it will be useful,
 
11
## but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
## GNU General Public License for more details.
 
14
##
 
15
## You should have received a copy of the GNU General Public License
 
16
## along with mm-common.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
## Parameters:  book_name
 
19
## Overrides:   pubdocbase, htmlrefpub, book_title, htmlref_patterns,
 
20
##              doc_outdir, doc_config, doc_postprocess, doc_install,
 
21
##              tagfile_to_devhelp2, doxytagfile, devhelpfile
 
22
## Files:       doc_input
 
23
## Output:      dist_noinst_DATA, DISTCLEANFILES, MAINTAINERCLEANFILES
 
24
 
 
25
# The name of the sub-directory where the generated documentation
 
26
# will be placed.
 
27
doc_outdir ?= reference
 
28
 
 
29
# The name of the Doxygen configuration file.
 
30
doc_config ?= $(doc_outdir)/Doxyfile
 
31
 
 
32
# The base URL where the online documentation for C++ binding modules
 
33
# is located, including the trailing slash.
 
34
pubdocbase ?= http://library.gnome.org/devel/
 
35
 
 
36
# The URL of the module's online HTML reference documentation, which
 
37
# may or may not end in a trailing slash.
 
38
htmlrefpub ?= $(pubdocbase)$(PACKAGE_TARNAME)/unstable/
 
39
 
 
40
# The title of the generated Devhelp book.
 
41
book_title ?= $(PACKAGE_NAME) Reference Manual
 
42
 
 
43
# A list of wildcard patterns matching the files from the HTML directory
 
44
# generated by Doxygen which should be distributed and installed.
 
45
htmlref_patterns ?= $(addprefix $(doc_outdir)/html/*.,css gif html png)
 
46
 
 
47
# Locations of utilities shipped with glibmm.  Made overridable
 
48
# in case the installed utilities cannot be used for some reason.
 
49
doc_postprocess     ?= $(PERL) -- "$(MMDOCTOOLDIR)/doc-postprocess.pl"
 
50
doc_install         ?= $(PERL) -- "$(MMDOCTOOLDIR)/doc-install.pl"
 
51
tagfile_to_devhelp2 ?= "$(MMDOCTOOLDIR)/tagfile-to-devhelp2.xsl"
 
52
 
 
53
# Names of the main output files.
 
54
doxytagfile ?= $(doc_outdir)/$(book_name).tag
 
55
devhelpfile ?= $(doc_outdir)/$(book_name).devhelp2
 
56
 
 
57
# Function: $(call vpath_listall,PATTERN ...)
 
58
# Get all filenames which match a PATTERN from the list.  Look for files
 
59
# relative to either the current directory or $(srcdir).  Strip $(srcdir)/
 
60
# again before returning and remove any duplicates.
 
61
vpath_srclist = $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(1))))
 
62
vpath_listall = $(sort $(wildcard $(1)) $(if $(srcdir:.=),$(vpath_srclist)))
 
63
 
 
64
# Installation directories.
 
65
libdocdir    = $(datarootdir)/doc/$(book_name)
 
66
referencedir = $(libdocdir)/reference
 
67
htmlrefdir   = $(referencedir)/html
 
68
devhelpdir   = $(datadir)/devhelp/books/$(book_name)
 
69
 
 
70
if ENABLE_DOCUMENTATION
 
71
doc_inst_targets = install-htmlref install-devhelp
 
72
doc_inst_files   = $(doxytagfile)
 
73
doc_dist_files   = $(devhelpfile) $(call vpath_listall,$(htmlref_patterns))
 
74
else
 
75
doc_inst_targets =
 
76
doc_inst_files   =
 
77
doc_dist_files   =
 
78
endif
 
79
 
 
80
dist_reference_DATA = $(strip $(doc_inst_files))
 
81
dist_noinst_DATA    = $(strip $(doc_dist_files))
 
82
 
 
83
DISTCLEANFILES       = $(doc_outdir)/doxygen.log
 
84
MAINTAINERCLEANFILES = $(doxytagfile) $(devhelpfile) $(doc_outdir)/html/*
 
85
 
 
86
# The generic bit of the doc-install.pl command line.
 
87
doc_install_cmd = $(doc_install) --verbose --mode=0644
 
88
 
 
89
# Transform $(datarootdir) into a URI to match MM_ARG_WITH_TAGFILE_DOC().
 
90
datarootdir_esc = $(subst $(subst ,, ),%20,$(subst \,/,$(datarootdir)))
 
91
docdir_base_uri = file:///$(patsubst /%,%,$(datarootdir_esc:/=))/doc
 
92
 
 
93
# The command and options used to install the files from the HTML reference
 
94
# documentation.  The $(subst) magic translates external tag references from
 
95
# absolute to relative paths if the destination is on the local file system
 
96
# and installed under the same prefix as the package being built.
 
97
htmlref_relinst = $(subst @$(docdir_base_uri)/,@../../../,$(DOCINSTALL_FLAGS))
 
98
htmlref_install = $(doc_install_cmd) $(htmlref_relinst)
 
99
 
 
100
# The command and options used to install the Devhelp file.
 
101
devhelp_install = $(doc_install_cmd) --book-base='$(htmlrefdir:/=)'
 
102
 
 
103
# Helper variables to replicate each pattern with a $(srcdir)/ prefix.
 
104
# Also add quoting to prevent the shell from expanding the patterns.
 
105
htmlref_patterns_dup   = $(foreach item,$(htmlref_patterns),'$(item)' '$(srcdir)/$(item)')
 
106
htmlref_patterns_quote = $(patsubst %,'%',$(htmlref_patterns))
 
107
htmlref_patterns_vpath = $(if $(srcdir:.=),$(htmlref_patterns_dup),$(htmlref_patterns_quote))
 
108
 
 
109
# Expand to a list of -name 'PATTERN' arguments for use with 'find'.
 
110
htmlref_find_patterns = $(patsubst %,-name '%' -o,$(notdir $(htmlref_patterns))) -false
 
111
 
 
112
# The parameters to the Doxygen-to-Devhelp XSLT script
 
113
dh_xsl_params = --stringparam book_title '$(book_title)' \
 
114
                --stringparam book_name '$(book_name)' \
 
115
                --stringparam book_base html
 
116
 
 
117
# Generated configuration files which, when updated, should cause the
 
118
# reference documentation to be rebuilt.
 
119
doc_config_deps = $(CONFIG_HEADER) $(srcdir)/$(doc_config).in $(srcdir)/Makefile.in
 
120
 
 
121
# Regenerate the documentation automatically only in maintainer mode.
 
122
# Depend on the generated configuration header files to trigger a rebuild
 
123
# if a configuration value changed.  The configuration header files only
 
124
# have their timestamp modified when the content actually changed, which
 
125
# is not the case for any other files generated by configure.
 
126
if MAINTAINER_MODE
 
127
doc_dependencies = $(doc_config_deps) $(doc_input)
 
128
else
 
129
doc_dependencies =
 
130
endif
 
131
 
 
132
# Explicitly depend on the files to be distributed or installed.
 
133
all-local: $(doc_inst_files) $(doc_dist_files)
 
134
 
 
135
# Hook up custom rules for translating references to external documentation
 
136
# to the actual location at install time.
 
137
install-data-local: $(doc_inst_targets)
 
138
 
 
139
# Hook up corresponding custom uninstall rules.
 
140
uninstall-local: $(addprefix un,$(doc_inst_targets))
 
141
 
 
142
# Install the HTML reference documentation files with just one invocation
 
143
# of doc-install.pl to speed up the build process.  Make use of the --glob
 
144
# option, which tells it to perform filename globbing itself, like 'find'.
 
145
# This helps to avoid excessively long command lines, as some platforms
 
146
# have rather restrictive limits.
 
147
install-htmlref: $(doc_outdir)/html/index.html
 
148
        @$(NORMAL_INSTALL)
 
149
        $(MKDIR_P) '$(DESTDIR)$(htmlrefdir)'
 
150
        $(htmlref_install) -t '$(DESTDIR)$(htmlrefdir)' --glob -- $(htmlref_patterns_vpath)
 
151
 
 
152
# Delete files from the html installation directory.  Avoid recursive
 
153
# directory removal, and apply the same wildcard pattern as was used to
 
154
# select files for installation.
 
155
uninstall-htmlref:
 
156
        @$(NORMAL_UNINSTALL)
 
157
        (cd '$(DESTDIR)$(htmlrefdir)' 2>/dev/null || exit 0; \
 
158
         find . -type f '(' $(htmlref_find_patterns) ')' -exec rm -f '{}' '+')
 
159
        -test ! -r '$(DESTDIR)$(htmlrefdir)' || rmdir '$(DESTDIR)$(htmlrefdir)'
 
160
 
 
161
# Install the Devhelp file, translating the base path on the fly.
 
162
install-devhelp: $(devhelpfile)
 
163
        @$(NORMAL_INSTALL)
 
164
        $(MKDIR_P) '$(DESTDIR)$(devhelpdir)'
 
165
        $(devhelp_install) -t '$(DESTDIR)$(devhelpdir)' -- $^
 
166
 
 
167
# Remove the installed Devhelp file and directory.
 
168
uninstall-devhelp:
 
169
        @$(NORMAL_UNINSTALL)
 
170
        rm -f '$(DESTDIR)$(devhelpdir)/$(notdir $(devhelpfile))'
 
171
        -test ! -r '$(DESTDIR)$(devhelpdir)' || rmdir '$(DESTDIR)$(devhelpdir)'
 
172
 
 
173
# Regenerate the Doxygen configuration file automatically.  In the
 
174
# top-level build directory Automake already takes care of this.
 
175
 ifneq ($(subdir),.)
 
176
$(doc_config): $(srcdir)/$(doc_config).in $(top_builddir)/config.status
 
177
        $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
178
 
 
179
 endif
 
180
# Make sure that the documentation will always have been generated before
 
181
# executing commands of a rule that depends on files in $(doc_outdir)/html/.
 
182
$(doc_outdir)/html/%: | $(doxytagfile)
 
183
 
 
184
# Run Doxygen to build the reference documentation. The generated tag file
 
185
# also functions as time stamp target for the documentation as a whole.
 
186
$(doxytagfile): $(doc_dependencies) | $(doc_config)
 
187
        -$(AM_V_at)rm -f $@
 
188
        -$(AM_V_at)rm -fr $(doc_outdir)/html
 
189
        $(AM_V_GEN)(echo '@INCLUDE =' $(doc_config) && echo 'INPUT =' $(doc_input)) | $(DOXYGEN) -
 
190
        $(AM_V_at)$(doc_postprocess) '$(doc_outdir)/html/*.html'
 
191
 
 
192
# Run XSL transformation to generate a Devhelp book from a Doxygen tag file.
 
193
%.devhelp2: %.tag
 
194
        $(AM_V_GEN)$(XSLTPROC) $(dh_xsl_params) -o $@ $(tagfile_to_devhelp2) $<
 
195
 
 
196
.PHONY: install-htmlref uninstall-htmlref install-devhelp uninstall-devhelp
 
197
 
 
198
# Instruct GNU make to delete the targets of a rule after it failed, in
 
199
# order to avoid the complication of handling that situation manually.
 
200
.DELETE_ON_ERROR: