]> git.tdb.fi Git - builder.git/blobdiff - source/archive.cpp
Change the default value of the cpu option to "none" since there's no actual autodete...
[builder.git] / source / archive.cpp
index 204b202c4863c112593edc50cf6e1d8fe0d53bcf..55b1f4615efe053bf1cf6dc68f915163929aae9d 100644 (file)
@@ -6,6 +6,7 @@ Distributed under the LGPL
 */
 
 #include <msp/fs/dir.h>
+#include <msp/fs/stat.h>
 #include <msp/fs/utils.h>
 #include "archive.h"
 #include "builder.h"
@@ -28,15 +29,19 @@ Archive::Archive(Builder &b, const StaticLibrary &lib):
        argv.push_back(builder.get_current_arch().get_tool(tool));
        argv.push_back("rc");
 
-       argv.push_back(relative(lib.get_name(), work_dir).str());
+       argv.push_back(relative(lib.get_path(), work_dir).str());
        const TargetList &deps=lib.get_depends();
        for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
-               if(dynamic_cast<ObjectFile *>(*i))
-                       argv.push_back(relative((*i)->get_name(), work_dir).str());
+               if(ObjectFile *obj=dynamic_cast<ObjectFile *>(*i))
+                       argv.push_back(relative(obj->get_path(), work_dir).str());
 
-       FS::Path lpath=lib.get_name();
+       FS::Path lpath=lib.get_path();
        if(!builder.get_dry_run())
+       {
                FS::mkpath(FS::dirname(lpath), 0755);
+               if(FS::exists(lib.get_path()))
+                       FS::unlink(lib.get_path());
+       }
 
        announce(comp.get_package().get_name(), tool, relative(lpath, work_dir).str());