]> git.tdb.fi Git - builder.git/commitdiff
Apply what-ifs after preparation so implicitly created targets may be specified
authorMikko Rasa <tdb@tdb.fi>
Sat, 23 Jun 2012 18:14:08 +0000 (21:14 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:53 +0000 (00:08 +0300)
source/builder.cpp

index 115968982ef93cb5b71700ae868a1c647ad3b499..4a9370fc19a0468ebe1ddb2b19cf57d7be8766ee 100644 (file)
@@ -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<string>::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<SourcePackage *>(i->second))
                        spkg->get_deps_cache().save();