summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2011-05-12 07:45:55 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-12 22:36:59 (GMT)
commit96a3bf7a8bbc1e5361e16cbeeceb4be674b88c30 (patch)
tree29dc4715466e108a53fe042bc58bfa6323d6b965
parent637456edef085d1825f15429cd921f2f0d4bd6a2 (diff)
downloadQt-96a3bf7a8bbc1e5361e16cbeeceb4be674b88c30.zip
Qt-96a3bf7a8bbc1e5361e16cbeeceb4be674b88c30.tar.gz
Qt-96a3bf7a8bbc1e5361e16cbeeceb4be674b88c30.tar.bz2
Ensure that recursive QMAKE_EXTRA_TARGETS use the correct makefile
Recursive QMAKE_EXTRA_TARGETS were omitting the `-f' option to make. This would break in the case where the correct makefile was not named `Makefile'. The included autotest demonstrates the problem. Note that this was fixed for normal targets back in 2005 by faac7bd178654fd67a6f3f9cf4f6f2605071448d (p4 202370), but was not fixed for extra targets. Reviewed-by: ossi
-rw-r--r--qmake/generators/makefile.cpp5
-rw-r--r--tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp3
-rw-r--r--tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro5
-rw-r--r--tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro7
-rw-r--r--tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro7
-rw-r--r--tests/auto/qmake/tst_qmake.cpp14
6 files changed, 37 insertions, 4 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 595768f..e4764e0 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2638,10 +2638,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
QString out_directory_cdin, out_directory_cdout;
MAKE_CD_IN_AND_OUT(out_directory);
- //don't need the makefile arg if it isn't changed
- QString makefilein;
- if(subtarget->makefile != "$(MAKEFILE)")
- makefilein = " -f " + subtarget->makefile;
+ QString makefilein = " -f " + subtarget->makefile;
//write the rule/depends
if(flags & SubTargetOrdered) {
diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp
new file mode 100644
index 0000000..3c850d4
--- /dev/null
+++ b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp
@@ -0,0 +1,3 @@
+int main(int,char**)
+{
+}
diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro
new file mode 100644
index 0000000..2db08a2
--- /dev/null
+++ b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro
@@ -0,0 +1,5 @@
+TEMPLATE = app
+SOURCES = main.cpp
+
+extratarget.commands = @echo extra target worked OK
+QMAKE_EXTRA_TARGETS += extratarget
diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro
new file mode 100644
index 0000000..be0d80a
--- /dev/null
+++ b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+SUBDIRS = simple
+
+extratarget.CONFIG = recursive
+extratarget.recurse = $$SUBDIRS
+extratarget.recurse_target = extratarget
+QMAKE_EXTRA_TARGETS += extratarget
diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro
new file mode 100644
index 0000000..7c07859
--- /dev/null
+++ b/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+SUBDIRS = subdir.pro
+
+extratarget.CONFIG = recursive
+extratarget.recurse = $$SUBDIRS
+extratarget.recurse_target = extratarget
+QMAKE_EXTRA_TARGETS += extratarget
diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp
index 81a51e1..afd28e1 100644
--- a/tests/auto/qmake/tst_qmake.cpp
+++ b/tests/auto/qmake/tst_qmake.cpp
@@ -69,6 +69,7 @@ private slots:
void simple_lib();
void simple_dll();
void subdirs();
+ void subdir_via_pro_file_extra_target();
void functions();
void operators();
void variables();
@@ -234,6 +235,19 @@ void tst_qmake::subdirs()
QVERIFY( test_compiler.removeMakefile( workDir ) );
}
+void tst_qmake::subdir_via_pro_file_extra_target()
+{
+ QString workDir = base_path + "/testdata/subdir_via_pro_file_extra_target";
+
+ QDir D;
+ D.remove( workDir + "/Makefile");
+ D.remove( workDir + "/Makefile.subdir");
+ D.remove( workDir + "/simple/Makefile");
+ D.remove( workDir + "/simple/Makefile.subdir");
+ QVERIFY( test_compiler.qmake( workDir, "subdir_via_pro_file_extra_target" ));
+ QVERIFY( test_compiler.make( workDir, "extratarget" ));
+}
+
void tst_qmake::functions()
{
QString workDir = base_path + "/testdata/functions";