]> git.tdb.fi Git - builder.git/blobdiff - source/target.cpp
Add a utility function for setting the executable for a Tool
[builder.git] / source / target.cpp
index 691f70038e932bb79df4f71567cd72eb1f197899..87b0d0078e16bcb565898c55ba6923e807b328c1 100644 (file)
@@ -64,7 +64,7 @@ Target *Target::get_buildable_target()
        return 0;
 }
 
-void Target::set_tool(const Tool &t)
+void Target::set_tool(Tool &t)
 {
        tool = &t;
        for(Dependencies::const_iterator i=side_effects.begin(); i!=side_effects.end(); ++i)
@@ -102,12 +102,12 @@ void Target::prepare()
        }
 
        state = PREPARING;
+       if(tool)
+               tool->prepare();
        find_dependencies();
        if(tool)
-       {
                if(FileTarget *tool_exe = tool->get_executable())
                        add_dependency(*tool_exe);
-       }
 
        for(Dependencies::iterator i=depends.begin(); i!=depends.end(); ++i)
                (*i)->prepare();
@@ -122,13 +122,6 @@ void Target::prepare()
 
 Task *Target::build()
 {
-       if(!tool)
-       {
-               // This special case is needed for VirtualTargets
-               state = UPTODATE;
-               return 0;
-       }
-
        Task *task = tool->run(*this);
        task->signal_finished.connect(sigc::mem_fun(this, &Target::build_finished));
        state = BUILDING;