X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffiletarget.cpp;h=88672317dc35cab7afa7c5fdef65a8d65edc7e57;hb=dad4c41302de525a1456e9d5b738831487c8acac;hp=d6dcd1681c4d589cdb7976279e7acfdc032dd46c;hpb=43bd25ffcb0b4f7882773f4676b209a99cb73c04;p=builder.git diff --git a/source/filetarget.cpp b/source/filetarget.cpp index d6dcd16..8867231 100644 --- a/source/filetarget.cpp +++ b/source/filetarget.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include "builder.h" #include "filetarget.h" @@ -9,11 +10,11 @@ using namespace std; using namespace Msp; FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a): - Target(b, p, FS::basename(a.str())), + Target(b, p, make_name(p, a)), path(a), size(0) { - builder.add_target(this); + builder.register_path(path, this); if(FS::Stat st = FS::lstat(path)) { @@ -58,3 +59,14 @@ void FileTarget::check_rebuild() if(!rebuild && spkg && spkg->get_config().get_mtime()>mtime) mark_rebuild("Package options changed"); } + +string FileTarget::make_name(const Package *pkg, const FS::Path &pth) +{ + if(const SourcePackage *spkg = dynamic_cast(pkg)) + { + FS::Path relpath = FS::relative(pth, spkg->get_source()); + return format("<%s>%s", pkg->get_name(), relpath.str().substr(1)); + } + else + return pth.str(); +}