From d1979ace8f81bcc9bcb66d9253094339cea3a205 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 5 Jan 2019 08:44:17 -0600 Subject: [PATCH] tools/mkconfig.c: Add definitions to distinguish between tristate 'y' and 'm' options. --- tools/cfgdefine.c | 11 +++++++++-- tools/mkconfig.c | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/cfgdefine.c b/tools/cfgdefine.c index 4349ef0cd18..78fd81b032c 100644 --- a/tools/cfgdefine.c +++ b/tools/cfgdefine.c @@ -343,8 +343,8 @@ void generate_definitions(FILE *stream) printf("#undef %s\n", varname); } - /* Simply define the configuration variable if it has the special - * value "y" + /* Simply define the configuration variable to '1' if it has the + * special value "y" */ else if (strcmp(varval, "y") == 0) @@ -352,6 +352,13 @@ void generate_definitions(FILE *stream) printf("#define %s 1\n", varname); } + /* Or to '2' if it has the special value "m" */ + + else if (strcmp(varval, "m") == 0) + { + printf("#define %s 2\n", varname); + } + /* Otherwise, use the value as provided */ else diff --git a/tools/mkconfig.c b/tools/mkconfig.c index 6a949e7ea2e..a5a8917a626 100644 --- a/tools/mkconfig.c +++ b/tools/mkconfig.c @@ -98,6 +98,10 @@ int main(int argc, char **argv, char **envp) printf("/* config.h -- Autogenerated! Do not edit. */\n\n"); printf("#ifndef __INCLUDE_NUTTX_CONFIG_H\n"); printf("#define __INCLUDE_NUTTX_CONFIG_H\n\n"); + printf("/* General Definitions ***********************************/\n"); + printf("/* Used to represent the values of tristate options */\n\n"); + printf("#define CONFIG_y 1\n"); + printf("#define CONFIG_m 2\n\n"); printf("/* Architecture-specific options *************************/\n\n"); generate_definitions(stream);