]> git.tdb.fi Git - builder.git/blob - source/virtualtarget.cpp
Add utility class for executing chains of tasks
[builder.git] / source / virtualtarget.cpp
1 #include <msp/fs/path.h>
2 #include <msp/fs/utils.h>
3 #include "builder.h"
4 #include "virtualtarget.h"
5
6 using namespace std;
7 using namespace Msp;
8
9 VirtualTarget::VirtualTarget(Builder &b, const string &n):
10         Target(b, n)
11 { }
12
13 void VirtualTarget::check_rebuild()
14 {
15         // Virtual targets are only rebuilt if their dependencies need rebuilding.
16         for(Dependencies::iterator i=depends.begin(); (i!=depends.end() && !needs_rebuild()); ++i)
17                 if((*i)->needs_rebuild())
18                         mark_rebuild((*i)->get_name()+" needs rebuilding");
19 }
20
21 Task *VirtualTarget::build()
22 {
23         state = UPTODATE;
24         return 0;
25 }