summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-23 00:14:11 -0400
committermidipix <writeonce@midipix.org>2018-06-23 01:41:52 -0400
commit3c1679cf361e3a919dcf70b7b73367d67caa65f8 (patch)
treebfd5ffa6e7cac391edbdc5ea818670def465f045
parent88e561cb708235241310f39b4a0f640c4805143e (diff)
downloadslibtool-3c1679cf361e3a919dcf70b7b73367d67caa65f8.tar.bz2
slibtool-3c1679cf361e3a919dcf70b7b73367d67caa65f8.tar.xz
driver: added SLBT_MODE_INFO, for more elegant flow control.
-rw-r--r--include/slibtool/slibtool.h1
-rw-r--r--src/driver/slbt_driver_ctx.c25
2 files changed, 17 insertions, 9 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 3502081..93982da 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -92,6 +92,7 @@ enum slbt_custom_error {
/* execution modes */
enum slbt_mode {
SLBT_MODE_UNKNOWN,
+ SLBT_MODE_INFO,
SLBT_MODE_CLEAN,
SLBT_MODE_COMPILE,
SLBT_MODE_EXECUTE,
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 77c505a..2f08895 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -414,8 +414,9 @@ static int slbt_init_host_params(
else
base = cctx->cargv[0];
- if ((cctx->mode == SLBT_MODE_COMPILE) || (cctx->mode == SLBT_MODE_LINK))
- fdumpmachine = true;
+ fdumpmachine = (cctx->mode == SLBT_MODE_COMPILE)
+ || (cctx->mode == SLBT_MODE_LINK)
+ || (cctx->mode == SLBT_MODE_INFO);
/* support the portbld <--> unknown synonym */
if (!(drvhost->machine = strdup(SLBT_MACHINE)))
@@ -1164,6 +1165,10 @@ int slbt_get_driver_ctx(
cctx.output = 0;
}
+ /* info mode */
+ if (cctx.drvflags & (SLBT_DRIVER_CONFIG | SLBT_DRIVER_FEATURES))
+ cctx.mode = SLBT_MODE_INFO;
+
/* driver context */
if (!(ctx = slbt_driver_ctx_alloc(meta,&cctx)))
return slbt_get_driver_ctx_fail(meta);
@@ -1177,9 +1182,10 @@ int slbt_get_driver_ctx(
ctx->cctx.cargv = sargv.cargv;
/* host params */
- if ((cctx.drvflags & SLBT_DRIVER_HEURISTICS)
- || (cctx.drvflags & SLBT_DRIVER_CONFIG)
- || (cctx.mode != SLBT_MODE_COMPILE)) {
+ if (cctx.mode == SLBT_MODE_COMPILE) {
+ (void)0;
+
+ } else {
if (slbt_init_host_params(
&ctx->cctx,
&ctx->host,
@@ -1187,10 +1193,11 @@ int slbt_get_driver_ctx(
&ctx->cctx.cfgmeta)) {
slbt_free_driver_ctx(&ctx->ctx);
return -1;
- } else
- slbt_init_flavor_settings(
- &ctx->cctx,0,
- &ctx->cctx.settings);
+ }
+
+ slbt_init_flavor_settings(
+ &ctx->cctx,0,
+ &ctx->cctx.settings);
}
/* ldpath */