]> git.tdb.fi Git - builder.git/blobdiff - source/objectfile.cpp
More flexible way to manage filename patterns
[builder.git] / source / objectfile.cpp
index 0536755bb26788354d5e147e021f38fe64d0af36..1e6cb232135ca489aeeacd2045d86168394b0098 100644 (file)
@@ -35,7 +35,8 @@ FS::Path ObjectFile::generate_target_path(const Component &comp, const FS::Path
                if(*i!=".")
                        fn += *i;
        }
-       return temp_dir/(FS::basepart(fn)+".o");
+       const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+       return temp_dir/arch.create_filename<ObjectFile>(FS::basepart(fn));
 }
 
 void ObjectFile::set_used_in_shared_library(bool u)
@@ -71,6 +72,7 @@ void ObjectFile::find_dependencies(FileTarget *tgt)
        }
        else
        {
+               FS::Path inst_dir = rtgt->get_component()->get_install_map().get_install_location(*rtgt);
                /* The target has been displaced by installing it.  Displace any
                dependencies that come from the same package as well. */
                const SourcePackage *tpkg = rtgt->get_package();
@@ -79,12 +81,13 @@ void ObjectFile::find_dependencies(FileTarget *tgt)
                        FileTarget *file = dynamic_cast<FileTarget *>(*i);
                        if(file && file->get_package()==tpkg && FS::descendant_depth(file->get_path(), tpkg->get_source_directory())>=0)
                        {
-                               FS::Path displaced = tgt->get_path()/FS::relative(file->get_path(), rtgt->get_path());
+                               const Component *tcomp = file->get_component();
+                               FS::Path dep_inst = tcomp->get_install_map().get_install_location(*file);
+                               FS::Path displaced = FS::dirname(tgt->get_path())/FS::relative(dep_inst, inst_dir)/FS::basename(file->get_path());
                                if(Target *ddep = builder.get_vfs().get_target(displaced))
                                        deps_to_add.push_back(ddep);
                                else
                                {
-                                       const Component *tcomp = file->get_component();
                                        const Component::OverlayList &overlays = tcomp->get_overlays();
                                        string last_dir = FS::basename(FS::dirname(displaced));
                                        for(Component::OverlayList::const_iterator j=overlays.begin(); j!=overlays.end(); ++j)