]> git.tdb.fi Git - builder.git/blobdiff - source/filetarget.cpp
Move to a more abstract way of defining warnings
[builder.git] / source / filetarget.cpp
index adbb058dc3d192483bbfa7c03f9d042f1e8dcfdb..21c2bbf2019bc9fb64bbd80a2f48408d239400ea 100644 (file)
@@ -39,9 +39,9 @@ void FileTarget::init(const SourcePackage *p)
 
 string FileTarget::generate_name(Builder &builder, const SourcePackage *pkg, const FS::Path &path)
 {
-       if(pkg && FS::descendant_depth(path, pkg->get_source())>=0)
+       if(pkg && FS::descendant_depth(path, pkg->get_source_directory())>=0)
        {
-               FS::Path relpath = FS::relative(path, pkg->get_source());
+               FS::Path relpath = FS::relative(path, pkg->get_source_directory());
                return format("<%s>%s", pkg->get_name(), relpath.str().substr(1));
        }
        else if(FS::descendant_depth(path, builder.get_prefix())>=0)
@@ -82,3 +82,11 @@ void FileTarget::check_rebuild()
        if(!needs_rebuild() && package && package->get_config().get_mtime()>mtime)
                mark_rebuild("Package options changed");
 }
+
+Task *FileTarget::build()
+{
+       if(tool && !builder.get_dry_run() && mtime)
+               FS::unlink(path);
+
+       return Target::build();
+}