From c1f21665c7010c70b87f79e1b81dc7f2564f26c9 Mon Sep 17 00:00:00 2001 From: midipix Date: Feb 13 2024 05:22:07 +0000 Subject: utility: newly added --config, now producing compatible --config output. --- diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index 409997d..6d29303 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -72,6 +72,7 @@ extern "C" { #define SLBT_DRIVER_EXPORT_DYNAMIC SLBT_DRIVER_XFLAG(0x0010) #define SLBT_DRIVER_STATIC_LIBTOOL_LIBS SLBT_DRIVER_XFLAG(0x0100) #define SLBT_DRIVER_OUTPUT_MACHINE SLBT_DRIVER_XFLAG(0x1000) +#define SLBT_DRIVER_OUTPUT_CONFIG SLBT_DRIVER_XFLAG(0x2000) #define SLBT_DRIVER_MODE_AR SLBT_DRIVER_XFLAG(0x010000) #define SLBT_DRIVER_MODE_AR_CHECK SLBT_DRIVER_XFLAG(0x020000) @@ -131,6 +132,7 @@ enum slbt_custom_error { /* execution modes */ enum slbt_mode { SLBT_MODE_UNKNOWN, + SLBT_MODE_CONFIG, SLBT_MODE_INFO, SLBT_MODE_CLEAN, SLBT_MODE_COMPILE, diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c index 0136625..9ac5669 100644 --- a/src/driver/slbt_amain.c +++ b/src/driver/slbt_amain.c @@ -65,6 +65,9 @@ static void slbt_perform_driver_actions(struct slbt_driver_ctx * dctx) if (dctx->cctx->drvflags & SLBT_DRIVER_FEATURES) slbt_output_features(dctx); + if (dctx->cctx->mode == SLBT_MODE_CONFIG) + slbt_output_config(dctx); + if (dctx->cctx->mode == SLBT_MODE_COMPILE) slbt_exec_compile(dctx,0); diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index bfb2206..a6e93d0 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -493,6 +493,10 @@ int slbt_get_driver_ctx( cctx.drvflags |= SLBT_DRIVER_INFO; break; + case TAG_CONFIG: + cctx.drvflags |= SLBT_DRIVER_OUTPUT_CONFIG; + break; + case TAG_DUMPMACHINE: cctx.drvflags |= SLBT_DRIVER_OUTPUT_MACHINE; break; @@ -773,6 +777,10 @@ int slbt_get_driver_ctx( cctx.output = 0; } + /* config mode */ + if (cctx.drvflags & SLBT_DRIVER_OUTPUT_CONFIG) + cctx.mode = SLBT_MODE_CONFIG; + /* info mode */ if (cctx.drvflags & (SLBT_DRIVER_INFO | SLBT_DRIVER_FEATURES)) cctx.mode = SLBT_MODE_INFO; diff --git a/src/driver/slbt_split_argv.c b/src/driver/slbt_split_argv.c index 04800d8..601c1ad 100644 --- a/src/driver/slbt_split_argv.c +++ b/src/driver/slbt_split_argv.c @@ -52,6 +52,7 @@ int slbt_split_argv( struct argv_entry * help; struct argv_entry * version; struct argv_entry * info; + struct argv_entry * config; struct argv_entry * finish; struct argv_entry * features; struct argv_entry * ccwrap; @@ -117,8 +118,8 @@ int slbt_split_argv( return -1; } - /* missing all of --mode, --help, --version, --info, --dumpmachine, --features, and --finish? */ - mode = help = version = info = finish = features = ccwrap = dumpmachine = aropt = 0; + /* missing all of --mode, --help, --version, --info, --config, --dumpmachine, --features, and --finish? */ + mode = help = version = info = config = finish = features = ccwrap = dumpmachine = aropt = 0; for (entry=meta->entries; entry->fopt; entry++) if (entry->tag == TAG_MODE) @@ -129,6 +130,8 @@ int slbt_split_argv( version = entry; else if (entry->tag == TAG_INFO) info = entry; + else if (entry->tag == TAG_CONFIG) + config = entry; else if (entry->tag == TAG_FINISH) finish = entry; else if (entry->tag == TAG_FEATURES) @@ -155,7 +158,7 @@ int slbt_split_argv( return -1; } - if (!mode && !help && !version && !info && !finish && !features && !dumpmachine && !altmode) { + if (!mode && !help && !version && !info && !config && !finish && !features && !dumpmachine && !altmode) { slbt_dprintf(fderr, "%s: error: --mode must be specified.\n", program); @@ -163,7 +166,7 @@ int slbt_split_argv( } /* missing compiler? */ - if (!ctx.unitidx && !help && !info && !version && !finish && !features && !dumpmachine && !altmode && !aropt) { + if (!ctx.unitidx && !help && !info && !config && !version && !finish && !features && !dumpmachine && !altmode && !aropt) { if (flags & SLBT_DRIVER_VERBOSITY_ERRORS) slbt_dprintf(fderr, "%s: error: is missing.\n", @@ -323,7 +326,7 @@ int slbt_split_argv( if (ctx.unitidx) { (void)0; - } else if (help || version || features || info || dumpmachine || altmode) { + } else if (help || version || features || info || config || dumpmachine || altmode) { for (i=0; itargv[i] = argv[i]; diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index f563638..948d68c 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -26,6 +26,7 @@ enum app_tags { TAG_HELP_ALL, TAG_VERSION, TAG_INFO, + TAG_CONFIG, TAG_DUMPMACHINE, TAG_DEBUG, TAG_DRY_RUN, diff --git a/src/skin/slbt_skin_default.c b/src/skin/slbt_skin_default.c index 1565173..43222ce 100644 --- a/src/skin/slbt_skin_default.c +++ b/src/skin/slbt_skin_default.c @@ -39,6 +39,9 @@ const struct argv_option slbt_default_options[] = { "a universal playground game; " "currently accepted tags are {%s}"}, + {"config", 0,TAG_CONFIG,ARGV_OPTARG_NONE,0,0,0, + "print a compatible --config output"}, + {"info", 0,TAG_INFO,ARGV_OPTARG_NONE,0,0,0, "display detected (or cached) environment information"},