2 #include <msp/regex++/regex++.h>
5 #include "sourcefile.h"
10 SourceFile::SourceFile(Builder &b, const Component *c, const string &n):
11 Target(b, c?&c->get_package():0, n),
15 void SourceFile::find_depends()
17 ifstream in(name.c_str());
20 Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]");
23 while(getline(in, line))
24 if(RegMatch match=r_include.match(line))
25 includes.push_back(match[1].str());
27 string path=name.substr(0, name.rfind('/'));
28 for(list<string>::iterator i=includes.begin(); i!=includes.end(); ++i)
30 Target *hdr=builder.get_header(*i, path, comp->get_build_info().incpath);
36 void SourceFile::check_rebuild()
38 for(list<Target *>::iterator i=depends.begin(); i!=depends.end(); ++i)
39 vmtime=max(vmtime, (*i)->get_virtual_mtime());