summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-08-18 09:44:27 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-08-23 11:52:55 (GMT)
commit82d5f0ae622d2579b925a5f6a8054eeeccb9a233 (patch)
treea27709aecb8d209180c9be497124ad004f6f2c25 /qmake/generators
parent2d60953c4664958c665114c52ce2b92ed11b1488 (diff)
downloadQt-82d5f0ae622d2579b925a5f6a8054eeeccb9a233.zip
Qt-82d5f0ae622d2579b925a5f6a8054eeeccb9a233.tar.gz
Qt-82d5f0ae622d2579b925a5f6a8054eeeccb9a233.tar.bz2
add indirect input/output specification capability to QMAKE_SUBSTITUTES
like in SUBDIRS, the specified strings can now be basenames of "structures" which specify the actual input and output files: QMAKE_SUBSTITUTES += test test.input = infile.txt.in test.output = foobar.out Reviewed-by: joerg
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/makefile.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 852471d..03732ba 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -466,14 +466,37 @@ MakefileGenerator::init()
if(!project->isEmpty("QMAKE_SUBSTITUTES")) {
const QStringList &subs = v["QMAKE_SUBSTITUTES"];
for(int i = 0; i < subs.size(); ++i) {
- if(!subs.at(i).endsWith(".in")) {
- warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'",
- subs.at(i).toLatin1().constData());
- continue;
+ QString inn = subs.at(i) + ".input", outn = subs.at(i) + ".output";
+ if (v.contains(inn) || v.contains(outn)) {
+ if (!v.contains(inn) || !v.contains(outn)) {
+ warn_msg(WarnLogic, "Substitute '%s' has only one of .input and .output",
+ subs.at(i).toLatin1().constData());
+ continue;
+ }
+ const QStringList &tinn = v[inn], &toutn = v[outn];
+ if (tinn.length() != 1) {
+ warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value",
+ subs.at(i).toLatin1().constData());
+ continue;
+ }
+ if (toutn.length() != 1) {
+ warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value",
+ subs.at(i).toLatin1().constData());
+ continue;
+ }
+ inn = tinn.first();
+ outn = toutn.first();
+ } else {
+ inn = subs.at(i);
+ if(!inn.endsWith(".in")) {
+ warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'",
+ inn.toLatin1().constData());
+ continue;
+ }
+ outn = inn.left(inn.length()-3);
}
- QFile in(fileFixify(subs.at(i)));
- QFile out(fileFixify(subs.at(i).left(subs.at(i).length()-3),
- qmake_getpwd(), Option::output_dir));
+ QFile in(fileFixify(inn));
+ QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir));
if(in.open(QFile::ReadOnly)) {
QString contents;
QStack<int> state;