Add config option to build documentation as a two-step process

The new 'prepare_docs' CONFIG option triggers the documentation rules in
default_post to generate two extra targets: prepare_docs and generate_docs.
The prepare_docs stage runs qdoc with the -prepare option, which means qdoc
will only generate index files, and the generate_docs stage will call
qdoc with -generate, which reads the index files and generates the final
output. The regular docs target will then run the prepare_docs target
for all submodules before running the generate_docs target.

This ensures that when generating the final output, qdoc has all the
index files for all the other modules available, to be able to resolve
cross-references between the various Qt modules.

This patch needs a follow-up in qt5.git to add CONFIG+=prepare_docs, so
that the root Qt5 build will be able to hook into this new behavior.

Change-Id: I654d7f0d4d5a41d9be208e6d3a8923bf0194f9ad
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
Tor Arne Vestbø 2012-10-22 12:17:19 +02:00
parent db97d35557
commit 600f2397b8
4 changed files with 22 additions and 7 deletions

2
configure vendored
View File

@ -6048,7 +6048,7 @@ fi
#-------------------------------------------------------------------------------
QTMODULE="$outpath/mkspecs/qmodule.pri"
echo "CONFIG += $QMAKE_CONFIG create_prl link_prl" >> "$QTMODULE.tmp"
echo "CONFIG += $QMAKE_CONFIG create_prl link_prl prepare_docs" >> "$QTMODULE.tmp"
echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS" >> "$QTMODULE.tmp"
if [ -n "$QT_CFLAGS_PSQL" ]; then

View File

@ -59,7 +59,13 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
!contains(QMAKE_EXTRA_TARGETS, docs) {
contains(TEMPLATE, subdirs) {
prepare_docs {
prepareRecursiveTarget(prepare_docs)
prepareRecursiveTarget(generate_docs)
docs.commands = $(MAKE) -f $(MAKEFILE) prepare_docs && $(MAKE) -f $(MAKEFILE) generate_docs
} else {
prepareRecursiveTarget(docs)
}
} else {
# apps and libs only generate docs if QMAKE_DOCS is set
!isEmpty(QMAKE_DOCS) {
@ -68,10 +74,19 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
for(index, QMAKE_DOCS_INDEX):QDOC_INDEX += -indexdir $$index
!isEmpty(QMAKE_DOCS_OUTPUTDIR):QMAKE_DOCS_OPTIONS += -outputdir $$QMAKE_DOCS_OUTPUTDIR
!isEmpty(QMAKE_DOCS_INSTALLDIR):QMAKE_DOCS_OPTIONS += -installdir $$QMAKE_DOCS_INSTALLDIR
docs.commands += $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS
doc_command = $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS
prepare_docs {
prepare_docs.commands += $$doc_command -prepare -no-link-errors
generate_docs.commands += $$doc_command -generate
docs.depends += generate_docs
} else {
docs.commands += $$doc_command
}
}
}
QMAKE_EXTRA_TARGETS += docs
prepare_docs: QMAKE_EXTRA_TARGETS += prepare_docs generate_docs
}
!contains(QMAKE_EXTRA_TARGETS, install_docs) {

View File

@ -38,6 +38,6 @@ SUBDIRS = $$TOOLS_SUBDIRS
# Ensure qdoc is built before making any docs. We rely on the existing dependency
# on bootstrap for each of the other tools to ensure they also build qdoc first,
# and likewise, the dependency of the rest of the build on tools, src, etc.
bootstrap_docs.depends += $${src_tools_qdoc.target}-make_first
bootstrap_docs.target = $${src_tools_bootstrap.target}-docs
QMAKE_EXTRA_TARGETS += bootstrap_docs
bootstrap_prepare_docs.depends += $${src_tools_qdoc.target}-make_first
bootstrap_prepare_docs.target = $${src_tools_bootstrap.target}-prepare_docs
QMAKE_EXTRA_TARGETS += bootstrap_prepare_docs

View File

@ -2724,7 +2724,7 @@ void Configure::generateCachefile()
if (!dictionary["DECORATIONS"].isEmpty())
moduleStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
moduleStream << "CONFIG += create_prl link_prl";
moduleStream << "CONFIG += create_prl link_prl prepare_docs";
if (dictionary[ "SSE2" ] == "yes")
moduleStream << " sse2";
if (dictionary[ "SSE3" ] == "yes")