2 #include <msp/strings/regex.h>
6 #include "sourcefile.h"
11 SourceFile::SourceFile(Builder &b, const Component *c, const string &n):
12 Target(b, c?&c->get_package():0, n),
17 Parses include directives from the file and looks up the appropriate targets
20 void SourceFile::find_depends()
22 ifstream in(name.c_str());
25 Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]");
28 while(getline(in, line))
29 if(RegMatch match=r_include.match(line))
30 includes.push_back(match[1].str);
32 const StringList &incpath=comp->get_build_info().incpath;
33 const string &arch=comp->get_package().get_arch();
35 string path=name.substr(0, name.rfind('/'));
36 for(list<string>::iterator i=includes.begin(); i!=includes.end(); ++i)
38 Target *hdr=builder.get_header(*i, arch, path, incpath);