summaryrefslogtreecommitdiffstats
path: root/mkspecs/features
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2012-10-17 14:13:19 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-18 21:01:09 +0200
commitb9facbf34595464f677e12ef5100328d4c318380 (patch)
tree49198a333af6f423a69202550ac763f424a4a76b /mkspecs/features
parentd060620e6cd3c94e7e0ff809b21593b9c0da0be2 (diff)
Refactor recursive target logic out of default_post into function
The qmake function prepareRecursiveTarget can now be used both by the existing logic in default_post, as well as future recursive targets that will be needed as part of the modularization of documentation builds. Change-Id: Ibc72c3e224cb57c9f1796de3b04fda9de663dbb4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r--mkspecs/features/default_post.prf36
-rw-r--r--mkspecs/features/qt_functions.prf26
2 files changed, 31 insertions, 31 deletions
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index 2542cb2f9d..003a73dedf 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -50,42 +50,16 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
# Let every project have a standard GNU `check' target
!contains(QMAKE_EXTRA_TARGETS, check) {
- # `make check' should iterate through all subdirs
- # (except those with no_default_target or no_check_target)
- contains(TEMPLATE, subdirs) {
- for(subdir, SUBDIRS) {
- subdir_config=$$eval($${subdir}.CONFIG)
- !contains(subdir_config, no_check_target):!contains(subdir_config, no_default_target):check.recurse += $$subdir
- unset(subdir_config)
- }
- !isEmpty(check.recurse) {
- # setup the recurse target only when there is to recurse into
- check.CONFIG = recursive
- check.recurse_target = check
- }
- }
- # `make check' should imply building the project
- else {
- check.depends = first
- }
+ contains(TEMPLATE, subdirs): \
+ prepareRecursiveTarget(check)
+ else: \
+ check.depends = first # `make check' implies build
QMAKE_EXTRA_TARGETS += check
}
-# Let every project have a 'docs' target
!contains(QMAKE_EXTRA_TARGETS, docs) {
contains(TEMPLATE, subdirs) {
- # `make docs' should iterate through all subdirs
- # (except those with no_default_target or no_docs_target)
- !contains(CONFIG, no_docs_target):for(subdir, SUBDIRS) {
- subdir_config = $$eval($${subdir}.CONFIG)
- !contains(subdir_config, no_docs_target):!contains(subdir_config, no_default_target):docs.recurse += $$subdir
- unset(subdir_config)
- }
- !isEmpty(docs.recurse) {
- # setup the recurse target only when there is something to recurse into
- docs.CONFIG = recursive
- docs.recurse_target = docs
- }
+ prepareRecursiveTarget(docs)
} else {
# apps and libs only generate docs if QMAKE_DOCS is set
!isEmpty(QMAKE_DOCS) {
diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
index f614ad8f07..2d8f81bae1 100644
--- a/mkspecs/features/qt_functions.prf
+++ b/mkspecs/features/qt_functions.prf
@@ -267,3 +267,29 @@ defineTest(packagesExist) {
return(true)
}
+# Prepares target that will iterate through all subdirs (except those
+# with no_default_target or no_{name_of_target}_target. The prepared
+# target must still be manually added to QMAKE_EXTRA_TARGETS.
+defineTest(prepareRecursiveTarget) {
+ target = $$1
+ no_$${target}_target: return()
+
+ for(subdir, SUBDIRS) {
+ subdir_config = $$eval($${subdir}.CONFIG)
+ contains(subdir_config, no_default_target): next()
+ contains(subdir_config, no_$${target}_target): next()
+
+ $${target}.recurse += $$subdir
+ }
+
+ # Set up the recurse target only when there
+ # is something to recurse into.
+ isEmpty($${target}.recurse): return()
+
+ $${target}.CONFIG = recursive
+ $${target}.recurse_target = $${target}
+
+ export($${target}.recurse)
+ export($${target}.CONFIG)
+ export($${target}.recurse_target)
+}