factor out qt_docs_targets.prf
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>
Wed, 28 Nov 2012 13:51:40 +0000 (14:51 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 28 Nov 2012 15:21:57 +0000 (16:21 +0100)
instead of letting *every* qmake-based project have recursive docs targets,
let qt modules "subscribe" to it explicitly by having load(qt_build_config)
in their .qmake.conf (which they already do).

Change-Id: I97b74591fd0c4bd5f8b08c5f550df9c7eef2f556
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
mkspecs/features/default_post.prf
mkspecs/features/qt_build_config.prf
mkspecs/features/qt_docs_targets.prf [new file with mode: 0644]

index bfabf25..6f3f318 100644 (file)
@@ -56,56 +56,3 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
         check.depends = first # `make check' implies build
     QMAKE_EXTRA_TARGETS += check
 }
-
-!contains(QMAKE_EXTRA_TARGETS, docs) {
-    contains(TEMPLATE, subdirs) {
-        prepare_docs {
-            prepareRecursiveTarget(prepare_docs)
-            prepareRecursiveTarget(generate_docs)
-            html_docs.commands = $(MAKE) -f $(MAKEFILE) prepare_docs && $(MAKE) -f $(MAKEFILE) generate_docs
-        } else {
-            prepareRecursiveTarget(html_docs)
-        }
-        prepareRecursiveTarget(qch_docs)
-        prepareRecursiveTarget(docs)
-    } else {
-        # apps and libs only generate docs if QMAKE_DOCS is set
-        !isEmpty(QMAKE_DOCS) {
-            !exists($$QMAKE_DOCS):error("Cannot find documentation specification file $$QMAKE_DOCS")
-            qtPrepareTool(QDOC, qdoc)
-            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
-            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
-                html_docs.depends += generate_docs
-            } else {
-                html_docs.commands += $$doc_command
-            }
-
-            qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
-            isEmpty(QMAKE_DOCS_TARGET): QMAKE_DOCS_TARGET = $$basename(QMAKE_DOCS_OUTPUTDIR)
-            qch_docs.commands = $$QHELPGENERATOR $$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp -o $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
-        }
-    }
-    docs.commands = $(MAKE) -f $(MAKEFILE) html_docs && $(MAKE) -f $(MAKEFILE) qch_docs
-    QMAKE_EXTRA_TARGETS += html_docs qch_docs docs
-    prepare_docs: QMAKE_EXTRA_TARGETS += prepare_docs generate_docs
-}
-
-!contains(QMAKE_EXTRA_TARGETS, install_docs) {
-    contains(TEMPLATE, subdirs) {
-        prepareRecursiveTarget(install_html_docs)
-        prepareRecursiveTarget(uninstall_html_docs)
-        prepareRecursiveTarget(install_qch_docs)
-        prepareRecursiveTarget(uninstall_qch_docs)
-        prepareRecursiveTarget(install_docs)
-        prepareRecursiveTarget(uninstall_docs)
-    }
-    QMAKE_EXTRA_TARGETS += \
-        install_html_docs uninstall_html_docs \
-        install_qch_docs uninstall_qch_docs \
-        install_docs uninstall_docs
-}
index 9d960e5..df07630 100644 (file)
@@ -27,7 +27,7 @@ mac {
 
 CONFIG += \
     create_prl link_prl \
-    prepare_docs \
+    prepare_docs qt_docs_targets \
     no_private_qt_headers_warning QTDIR_build \
     # Qt modules get compiled without exceptions enabled by default.
     # However, testcases should be still built with exceptions.
diff --git a/mkspecs/features/qt_docs_targets.prf b/mkspecs/features/qt_docs_targets.prf
new file mode 100644 (file)
index 0000000..69eefe9
--- /dev/null
@@ -0,0 +1,52 @@
+!contains(QMAKE_EXTRA_TARGETS, docs) {
+    contains(TEMPLATE, subdirs) {
+        prepare_docs {
+            prepareRecursiveTarget(prepare_docs)
+            prepareRecursiveTarget(generate_docs)
+            html_docs.commands = $(MAKE) -f $(MAKEFILE) prepare_docs && $(MAKE) -f $(MAKEFILE) generate_docs
+        } else {
+            prepareRecursiveTarget(html_docs)
+        }
+        prepareRecursiveTarget(qch_docs)
+        prepareRecursiveTarget(docs)
+    } else {
+        # apps and libs only generate docs if QMAKE_DOCS is set
+        !isEmpty(QMAKE_DOCS) {
+            !exists($$QMAKE_DOCS):error("Cannot find documentation specification file $$QMAKE_DOCS")
+            qtPrepareTool(QDOC, qdoc)
+            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
+            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
+                html_docs.depends += generate_docs
+            } else {
+                html_docs.commands += $$doc_command
+            }
+
+            qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
+            isEmpty(QMAKE_DOCS_TARGET): QMAKE_DOCS_TARGET = $$basename(QMAKE_DOCS_OUTPUTDIR)
+            qch_docs.commands = $$QHELPGENERATOR $$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp -o $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+        }
+    }
+    docs.commands = $(MAKE) -f $(MAKEFILE) html_docs && $(MAKE) -f $(MAKEFILE) qch_docs
+    QMAKE_EXTRA_TARGETS += html_docs qch_docs docs
+    prepare_docs: QMAKE_EXTRA_TARGETS += prepare_docs generate_docs
+}
+
+!contains(QMAKE_EXTRA_TARGETS, install_docs) {
+    contains(TEMPLATE, subdirs) {
+        prepareRecursiveTarget(install_html_docs)
+        prepareRecursiveTarget(uninstall_html_docs)
+        prepareRecursiveTarget(install_qch_docs)
+        prepareRecursiveTarget(uninstall_qch_docs)
+        prepareRecursiveTarget(install_docs)
+        prepareRecursiveTarget(uninstall_docs)
+    }
+    QMAKE_EXTRA_TARGETS += \
+        install_html_docs uninstall_html_docs \
+        install_qch_docs uninstall_qch_docs \
+        install_docs uninstall_docs
+}