]> git.tdb.fi Git - builder.git/blobdiff - source/target.cpp
Make targets depend on their tools
[builder.git] / source / target.cpp
index 1aab4b1fdef5a2f16fc04d4a674a0b5efb043a71..510dfbdf708fa83cd57ee0426a3b0b1c01fc5a56 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/fs/stat.h>
 #include <msp/fs/utils.h>
+#include <msp/strings/format.h>
 #include "builder.h"
 #include "filetarget.h"
 #include "package.h"
@@ -74,6 +75,11 @@ void Target::prepare()
 
        state = PREPARING;
        find_depends();
+       if(tool)
+       {
+               if(FileTarget *tool_exe = tool->get_executable())
+                       add_depend(tool_exe);
+       }
 
        for(Dependencies::iterator i=depends.begin(); i!=depends.end(); ++i)
                (*i)->prepare();
@@ -111,6 +117,8 @@ void Target::mark_rebuild(const std::string &reason)
        state = REBUILD;
        rebuild_reason = reason;
        signal_bubble_rebuild.emit();
+
+       builder.get_logger().log("rebuild", format("Rebuilding %s: %s", name, reason));
 }
 
 void Target::build_finished(bool /*success*/)