]> git.tdb.fi Git - builder.git/blobdiff - source/target.cpp
Rework the Target class hierarchy
[builder.git] / source / target.cpp
index b24013aaf55eabb094c72ef912480a956c6a9ae8..38eaab59708440fb3d70bd3761ac4e793e53f321 100644 (file)
@@ -10,6 +10,7 @@ Distributed under the LGPL
 #include <msp/time/utils.h>
 #include "action.h"
 #include "builder.h"
+#include "filetarget.h"
 #include "package.h"
 #include "sourcepackage.h"
 #include "target.h"
@@ -29,10 +30,6 @@ Target::Target(Builder &b, const Package *p, const string &n):
        counted(false)
 {
        builder.add_target(this);
-
-       struct stat st;
-       if(!FS::stat(name, st))
-               mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
 }
 
 Target *Target::get_buildable_target()
@@ -85,8 +82,9 @@ Action *Target::build()
                return 0;
        }
 
-       if(!builder.get_dry_run() && FS::exists(name))
-               FS::unlink(name);
+       if(FileTarget *ft=dynamic_cast<FileTarget *>(this))
+               if(!builder.get_dry_run() && FS::exists(ft->get_path()))
+                       FS::unlink(ft->get_path());
 
        Action *action=create_action();
        if(action)