From b9facbf34595464f677e12ef5100328d4c318380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 17 Oct 2012 14:13:19 +0200 Subject: 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 --- mkspecs/features/default_post.prf | 36 +++++------------------------------- mkspecs/features/qt_functions.prf | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'mkspecs') 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) +} -- cgit v1.2.3