1 #include <msp/path/utils.h>
6 #include "objectfile.h"
8 #include "sourcefile.h"
13 ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &src):
14 Target(b, &c.get_package(), generate_target_name(c, src.get_name())),
21 void ObjectFile::find_depends()
23 find_depends(depends.front());
26 Action *ObjectFile::build()
28 return Target::build(new Compile(builder, depends.front()->get_name(), name, comp));
31 void ObjectFile::find_depends(Target *tgt)
33 SourceFile *src=dynamic_cast<SourceFile *>(tgt);
36 Install *inst=dynamic_cast<Install *>(tgt);
38 src=dynamic_cast<SourceFile *>(inst->get_depends().front());
43 const string &sname=src->get_name();
44 string path=sname.substr(0, sname.rfind('/'));
46 const list<string> &includes=src->get_includes();
47 for(list<string>::const_iterator i=includes.begin(); i!=includes.end(); ++i)
49 Target *hdr2=builder.get_header(*i, path, package->get_build_info().incpath);
55 string ObjectFile::generate_target_name(const Component &comp, const string &src)
57 return (comp.get_package().get_source()/"temp"/comp.get_name()/(Path::splitext(src.substr(src.rfind('/')+1)).base+".o")).str();