summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-22 04:27:06 -0400
committermidipix <writeonce@midipix.org>2016-04-23 09:25:10 -0400
commitd117fced27de17371e60d15a34fd0200d6d2c81a (patch)
treebdf8ae2ca95dcc1c0504d89ff3d79163a8b4bcfb /src/logic
parent63a1b4f797559545e3ed60b387e969ecf79d3e57 (diff)
downloadslibtool-d117fced27de17371e60d15a34fd0200d6d2c81a.tar.bz2
slibtool-d117fced27de17371e60d15a34fd0200d6d2c81a.tar.xz
compile mode: remove .lo object file prior to invoking the compiler.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_compile.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/logic/slbt_exec_compile.c b/src/logic/slbt_exec_compile.c
index 53de294..4d645d2 100644
--- a/src/logic/slbt_exec_compile.c
+++ b/src/logic/slbt_exec_compile.c
@@ -13,6 +13,21 @@
#include <slibtool/slibtool.h>
#include "slibtool_spawn_impl.h"
+static int slbt_exec_compile_remove_file(
+ const struct slbt_driver_ctx * dctx,
+ struct slbt_exec_ctx * ectx,
+ const char * target)
+{
+ /* remove target (if any) */
+ if (!(unlink(target)) || (errno == ENOENT))
+ return 0;
+
+ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT))
+ strerror(errno);
+
+ return -1;
+}
+
int slbt_exec_compile(
const struct slbt_driver_ctx * dctx,
struct slbt_exec_ctx * ectx)
@@ -30,6 +45,10 @@ int slbt_exec_compile(
else
actx = ectx;
+ /* remove old .lo wrapper */
+ if (slbt_exec_compile_remove_file(dctx,ectx,ectx->ltobjname))
+ return -1;
+
/* .libs directory */
if (dctx->cctx->drvflags & SLBT_DRIVER_SHARED) {
if ((fdlibs = open(ectx->ldirname,O_DIRECTORY)) >= 0)