X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fobjectfile.cpp;h=cb42a8e78edfa6f7fbfe873245f748896c3f9b58;hb=43bd25ffcb0b4f7882773f4676b209a99cb73c04;hp=f3d6183afa6b01161b1039af0bb6f838d571e5d8;hpb=05a2b9dabd01414e9e9a91f9d69babaca4ccb32d;p=builder.git diff --git a/source/objectfile.cpp b/source/objectfile.cpp index f3d6183..cb42a8e 100644 --- a/source/objectfile.cpp +++ b/source/objectfile.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include #include "builder.h" @@ -19,7 +12,7 @@ using namespace std; using namespace Msp; ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s): - FileTarget(b, &c.get_package(), generate_target_path(c, FS::basename(s.get_path()))), + FileTarget(b, &c.get_package(), generate_target_path(c, FS::relative(s.get_path(), c.get_package().get_source()).str())), comp(c), source(s) { @@ -78,5 +71,11 @@ Action *ObjectFile::create_action() FS::Path ObjectFile::generate_target_path(const Component &comp, const string &src) { const SourcePackage &pkg = comp.get_package(); - return pkg.get_temp_dir()/comp.get_name()/(FS::basepart(src)+".o"); + string fn = FS::basepart(src)+".o"; + if(!fn.compare(0, 2, "./")) + fn.erase(0, 2); + for(string::iterator i=fn.begin(); i!=fn.end(); ++i) + if(*i=='/') + *i = '_'; + return pkg.get_temp_dir()/comp.get_name()/fn; }