FS::Path ObjectFile::generate_target_path(const Component &comp, const FS::Path &src)
{
const SourcePackage &pkg = comp.get_package();
- FS::Path rel_src = FS::relative(src, pkg.get_source_directory()).str();
+ FS::Path temp_dir = pkg.get_temp_directory()/comp.get_name();
+ FS::Path rel_src;
+ if(FS::descendant_depth(src, temp_dir)>=0)
+ rel_src = FS::relative(src, temp_dir);
+ else
+ rel_src = FS::relative(src, pkg.get_source_directory());
string fn;
for(FS::Path::Iterator i=rel_src.begin(); i!=rel_src.end(); ++i)
{
if(*i!=".")
fn += *i;
}
- return pkg.get_temp_directory()/comp.get_name()/(FS::basepart(fn)+".o");
+ return temp_dir/(FS::basepart(fn)+".o");
}
void ObjectFile::find_dependencies()
for(Dependencies::const_iterator i=deps_to_add.begin(); i!=deps_to_add.end(); ++i)
if(find(depends.begin(), depends.end(), *i)==depends.end())
+ {
add_dependency(**i);
+ if((*i)->get_real_target()->is_buildable())
+ (*i)->signal_modified.connect(sigc::mem_fun(this, static_cast<void (ObjectFile::*)()>(&ObjectFile::find_dependencies)));
+ }
}