From 09e3e740adfc08723275c8c7d9860d37fc61d8dd Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Wed, 3 Jun 2009 11:48:02 +1000 Subject: Fixed recursive QMAKE_EXTRA_TARGETS not being generated correctly for SUBDIRS projects when using abld. Acked-by: Miikka Heikkinen --- qmake/generators/makefile.cpp | 101 +++++++++++++++++------------- qmake/generators/makefile.h | 3 + qmake/generators/symbian/symmake_abld.cpp | 12 +++- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 82703c5..5f38bc7 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2234,8 +2234,8 @@ MakefileGenerator::writeHeader(QTextStream &t) t << endl; } -void -MakefileGenerator::writeSubDirs(QTextStream &t) +QList +MakefileGenerator::findSubDirsSubTargets() const { QList targets; { @@ -2332,6 +2332,13 @@ MakefileGenerator::writeSubDirs(QTextStream &t) } } } + return targets; +} + +void +MakefileGenerator::writeSubDirs(QTextStream &t) +{ + QList targets = findSubDirsSubTargets(); t << "first: make_default" << endl; int flags = SubTargetInstalls; if(project->isActiveConfig("ordered")) @@ -2348,39 +2355,43 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListtarget; + t << endl << endl; + } writeExtraVariables(t); - t << "SUBTARGETS = "; // subtargets are sub-directory - for(int target = 0; target < targets.size(); ++target) - t << " \\\n\t\t" << targets.at(target)->target; - t << endl << endl; QStringList targetSuffixes; const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); - targetSuffixes << "make_default" << "make_first" << "all" << "clean" << "distclean" - << QString((flags & SubTargetInstalls) ? "install_subtargets" : "install") - << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall"); + if (!(flags & SubTargetSkipDefaultTargets)) { + targetSuffixes << "make_default" << "make_first" << "all" << "clean" << "distclean" + << QString((flags & SubTargetInstalls) ? "install_subtargets" : "install") + << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall"); + } // generate target rules for(int target = 0; target < targets.size(); ++target) { @@ -2500,23 +2511,25 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListvalues("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1) - project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all"); + if (!(flags & SubTargetSkipDefaultTargets)) { + if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1) + project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all"); - writeMakeQmake(t); + writeMakeQmake(t); - t << "qmake_all:"; - if(!targets.isEmpty()) { - for(QList::Iterator it = targets.begin(); it != targets.end(); ++it) { - if(!(*it)->profile.isEmpty()) - t << " " << (*it)->target << "-" << "qmake_all"; + t << "qmake_all:"; + if(!targets.isEmpty()) { + for(QList::Iterator it = targets.begin(); it != targets.end(); ++it) { + if(!(*it)->profile.isEmpty()) + t << " " << (*it)->target << "-" << "qmake_all"; + } } + if(project->isEmpty("QMAKE_NOFORCE")) + t << " FORCE"; + if(project->isActiveConfig("no_empty_targets")) + t << "\n\t" << "@cd ."; + t << endl << endl; } - if(project->isEmpty("QMAKE_NOFORCE")) - t << " FORCE"; - if(project->isActiveConfig("no_empty_targets")) - t << "\n\t" << "@cd ."; - t << endl << endl; for(int s = 0; s < targetSuffixes.size(); ++s) { QString suffix = targetSuffixes.at(s); diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 9896c1d..a6eec52 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -121,9 +121,12 @@ protected: enum SubTargetFlags { SubTargetInstalls=0x01, SubTargetOrdered=0x02, + SubTargetSkipDefaultVariables=0x04, + SubTargetSkipDefaultTargets=0x08, SubTargetsNoFlags=0x00 }; + QList findSubDirsSubTargets() const; void writeSubTargets(QTextStream &t, QList subtargets, int flags); //extra compiler interface diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 32d08f6..8501224 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -184,6 +184,10 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool t << "#" << endl; t << "# ==============================================================================" << "\n" << endl; t << endl; + QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); + if(ofile.lastIndexOf(Option::dir_sep) != -1) + ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1); + t << "MAKEFILE = " << ofile << endl; t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; @@ -273,8 +277,6 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool } - writeExtraTargets(t); - // pre_targetdeps target depends on: // - all targets specified in PRE_TARGETDEPS // - the GENERATED_SOURCES sources (so that they get generated) @@ -285,6 +287,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool // so supporting generating sources is the best we can do. This is enough for mocs. if (!isSubdirs) { + writeExtraTargets(t); writeExtraCompilerTargets(t); t << CREATE_TEMPS_TARGET ":" << endl; @@ -345,6 +348,11 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool } t << endl; } + else { + QList subtargets = findSubDirsSubTargets(); + writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets); + qDeleteAll(subtargets); + } writeDeploymentTargets(t); -- cgit v0.12