1#
2#  W A R N I N G
3#  -------------
4#
5# This file is not part of the Qt API.  It exists purely as an
6# implementation detail.  It may change from version to version
7# without notice, or even be removed.
8#
9# We mean it.
10#
11
12# Ensure that each module has a .qmake.cache when properly qmake'd.
13cache()
14
15load(qt_configure)
16
17load(qt_build_config)
18
19TEMPLATE = subdirs
20
21bp = $$eval($$upper($$TARGET)_BUILD_PARTS)
22!isEmpty(bp): QT_BUILD_PARTS = $$bp
23
24exists($$_PRO_FILE_PWD_/src/src.pro) {
25    sub_src.subdir = src
26    sub_src.target = sub-src
27    SUBDIRS += sub_src
28
29    exists($$_PRO_FILE_PWD_/tools/tools.pro) {
30        sub_tools.subdir = tools
31        sub_tools.target = sub-tools
32        sub_tools.depends = sub_src
33        # conditional treatment happens on a case-by-case basis
34        SUBDIRS += sub_tools
35    }
36}
37
38exists($$_PRO_FILE_PWD_/examples/examples.pro) {
39    sub_examples.subdir = examples
40    sub_examples.target = sub-examples
41    contains(SUBDIRS, sub_src): sub_examples.depends = sub_src
42    contains(SUBDIRS, sub_tools): sub_examples.depends += sub_tools
43    !contains(QT_BUILD_PARTS, examples): sub_examples.CONFIG = no_default_target no_default_install
44    SUBDIRS += sub_examples
45}
46
47exists($$_PRO_FILE_PWD_/tests/tests.pro) {
48    sub_tests.subdir = tests
49    sub_tests.target = sub-tests
50    contains(SUBDIRS, sub_src): sub_tests.depends = sub_src   # The tests may have a run-time only dependency on other parts
51    contains(SUBDIRS, sub_tools): sub_tests.depends += sub_tools
52    sub_tests.CONFIG = no_default_install
53    !contains(QT_BUILD_PARTS, tests): sub_tests.CONFIG += no_default_target
54    SUBDIRS += sub_tests
55}
56
57QT_BUILD_PARTS -= libs tools examples tests
58!isEmpty(QT_BUILD_PARTS): warning("Unknown build part(s): $$QT_BUILD_PARTS")
59
60QMAKE_DISTCLEAN += \
61    .qmake.cache \
62    config.cache \
63    config.log \
64    mkspecs/modules/*.pri \
65    mkspecs/modules-inst/*.pri
66
67tests = $$files($$_PRO_FILE_PWD_/config.tests/*.pro, true)
68testdirs =
69for (t, tests): \
70    testdirs += $$relative_path($$dirname(t), $$_PRO_FILE_PWD_)
71testdirs = $$unique(testdirs)
72for (td, testdirs) {
73    t = $$basename(td)-distclean
74    $${t}.commands = -$$QMAKE_CD $$shell_path($$td) && $(MAKE) distclean
75    QMAKE_EXTRA_TARGETS += $$t
76    DISTCLEAN_DEPS += $$t
77}
78