]> git.tdb.fi Git - builder.git/blob - source/objectfile.cpp
b308c2b34301bc51c81929b25df7e86a5d6fbfa1
[builder.git] / source / objectfile.cpp
1 #include <msp/path/utils.h>
2 #include "builder.h"
3 #include "component.h"
4 #include "objectfile.h"
5 #include "package.h"
6 #include "sourcefile.h"
7
8 using namespace std;
9 using namespace Msp;
10
11 ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &src):
12         Target(b, &c.get_package(), generate_target_name(c, src.get_name())),
13         comp(c)
14 {
15         add_depend(&src);
16 }
17
18 string ObjectFile::generate_target_name(const Component &comp, const string &src)
19 {
20         return (comp.get_package().get_source()/"temp"/comp.get_name()/(Path::splitext(src.substr(src.rfind('/')+1)).base+".o")).str();
21 }