From 5aae4bb6c4d410c35c7ced08cae21ff3273d5155 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 9 Mar 2016 23:26:17 -0500 Subject: struct slbt_exec_ctx: added placeholders for quick handling of different modes. --- src/logic/slbt_exec_ctx.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/logic/slbt_exec_ctx.c b/src/logic/slbt_exec_ctx.c index e191585..cfa7434 100644 --- a/src/logic/slbt_exec_ctx.c +++ b/src/logic/slbt_exec_ctx.c @@ -183,20 +183,19 @@ int slbt_get_exec_ctx( } } - if (dctx->cctx->mode == SLBT_MODE_COMPILE) { - if (dctx->cctx->drvflags & SLBT_DRIVER_SHARED) { - ictx->ctx.argv[i++] = "-DPIC"; - ictx->ctx.argv[i++] = "-fPIC"; - } + /* placeholders for -DPIC, -fPIC, -c, -o, */ + ictx->ctx.dpic = &ictx->ctx.argv[i++]; + ictx->ctx.fpic = &ictx->ctx.argv[i++]; + ictx->ctx.cass = &ictx->ctx.argv[i++]; - ictx->ctx.argv[i++] = "-c"; - } + ictx->ctx.lout[0] = &ictx->ctx.argv[i++]; + ictx->ctx.lout[1] = &ictx->ctx.argv[i++]; /* output file name */ if (ref) { - ictx->ctx.argv[i++] = "-o"; - ictx->ctx.argv[i++] = ch; - ictx->ctx.lobjname = ch; + *ictx->ctx.lout[0] = "-o"; + *ictx->ctx.lout[1] = ch; + ictx->ctx.lobjname = ch; sprintf(ch,"%s%s", ictx->ctx.ldirname, @@ -229,3 +228,14 @@ void slbt_free_exec_ctx(struct slbt_exec_ctx * ctx) slbt_free_exec_ctx_impl(ictx,0); } } + + +void slbt_reset_placeholders(struct slbt_exec_ctx * ectx) +{ + *ectx->dpic = "-DSLIBTOOL_PLACEHOLDER_DPIC"; + *ectx->fpic = "-DSLIBTOOL_PLACEHOLDER_FPIC"; + *ectx->cass = "-DSLIBTOOL_PLACEHOLDER_COMPILE_ASSEMBLE"; + + *ectx->lout[0] = "-DSLIBTOOL_PLACEHOLDER_OUTPUT_SWITCH"; + *ectx->lout[1] = "-DSLIBTOOL_PLACEHOLDER_OUTPUT_FILE"; +} -- cgit v1.2.3