From f454064e4ec19c1a0f43d1efe0be9079bd99a81d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 23 Jun 2012 21:14:08 +0300 Subject: [PATCH] Apply what-ifs after preparation so implicitly created targets may be specified --- source/builder.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/source/builder.cpp b/source/builder.cpp index 1159689..4a9370f 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -497,19 +497,6 @@ int Builder::create_targets() if(i->second && i->second->is_configured()) i->second->create_targets(); - // Apply what-ifs - // XXX This does not currently work with targets found during dependency discovery - for(StringList::iterator i=what_if.begin(); i!=what_if.end(); ++i) - { - FileTarget *tgt = vfs.get_target(cwd/ *i); - if(!tgt) - { - IO::print(IO::cerr, "Unknown what-if target %s\n", *i); - return -1; - } - tgt->touch(); - } - // Make the cmdline target depend on all targets mentioned on the command line Target *cmdline = new VirtualTarget(*this, "cmdline"); for(list::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i) @@ -530,6 +517,18 @@ int Builder::create_targets() cmdline->prepare(); + // Apply what-ifs + for(StringList::iterator i=what_if.begin(); i!=what_if.end(); ++i) + { + FileTarget *tgt = vfs.get_target(cwd/ *i); + if(!tgt) + { + IO::print(IO::cerr, "Unknown what-if target %s\n", *i); + return -1; + } + tgt->touch(); + } + for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i) if(SourcePackage *spkg = dynamic_cast(i->second)) spkg->get_deps_cache().save(); -- 2.43.0