]> git.tdb.fi Git - builder.git/blobdiff - source/filetarget.cpp
Get rid of the global TargetList typedef
[builder.git] / source / filetarget.cpp
index 88672317dc35cab7afa7c5fdef65a8d65edc7e57..ad3786c76611d3012adcd154ef6bcfbac3210485 100644 (file)
@@ -14,7 +14,7 @@ FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
        path(a),
        size(0)
 {
-       builder.register_path(path, this);
+       builder.get_vfs().register_path(path, this);
 
        if(FS::Stat st = FS::lstat(path))
        {
@@ -39,7 +39,7 @@ void FileTarget::check_rebuild()
                mark_rebuild("Does not exist");
        else
        {
-               for(TargetList::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i)
+               for(Dependencies::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i)
                {
                        FileTarget *ft = dynamic_cast<FileTarget *>(*i);
                        if(ft && ft->get_mtime()>mtime)
@@ -64,9 +64,17 @@ string FileTarget::make_name(const Package *pkg, const FS::Path &pth)
 {
        if(const SourcePackage *spkg = dynamic_cast<const SourcePackage *>(pkg))
        {
-               FS::Path relpath = FS::relative(pth, spkg->get_source());
-               return format("<%s>%s", pkg->get_name(), relpath.str().substr(1));
+               if(FS::descendant_depth(pth, spkg->get_source())>=0)
+               {
+                       FS::Path relpath = FS::relative(pth, spkg->get_source());
+                       return format("<%s>%s", pkg->get_name(), relpath.str().substr(1));
+               }
+               else if(FS::descendant_depth(pth, pkg->get_builder().get_prefix())>=0)
+               {
+                       FS::Path relpath = FS::relative(pth, pkg->get_builder().get_prefix());
+                       return "<prefix>"+relpath.str().substr(1);
+               }
        }
-       else
-               return pth.str();
+
+       return pth.str();
 }