aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
authorArnaud Lacombe <lacombar@gmail.com>2010-08-14 23:57:43 -0400
committerArnaud Lacombe <lacombar@gmail.com>2010-09-19 18:19:26 -0400
commitffb5957bc48f64f0773fd3fbc43cb9bb9b38e270 (patch)
tree968f267b45d124519d681c086c5bba826b0824b6 /scripts/kconfig/confdata.c
parent59dfa24da7cb02b3ccc39f5e74b74fe26ea9626a (diff)
kconfig: allow build-time definition of the internal config prefix
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index d9181de78927..9f3c8899da5a 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -222,22 +222,22 @@ load:
222 conf_lineno++; 222 conf_lineno++;
223 sym = NULL; 223 sym = NULL;
224 if (line[0] == '#') { 224 if (line[0] == '#') {
225 if (memcmp(line + 2, "CONFIG_", 7)) 225 if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
226 continue; 226 continue;
227 p = strchr(line + 9, ' '); 227 p = strchr(line + 2 + strlen(CONFIG_), ' ');
228 if (!p) 228 if (!p)
229 continue; 229 continue;
230 *p++ = 0; 230 *p++ = 0;
231 if (strncmp(p, "is not set", 10)) 231 if (strncmp(p, "is not set", 10))
232 continue; 232 continue;
233 if (def == S_DEF_USER) { 233 if (def == S_DEF_USER) {
234 sym = sym_find(line + 9); 234 sym = sym_find(line + 2 + strlen(CONFIG_));
235 if (!sym) { 235 if (!sym) {
236 sym_add_change_count(1); 236 sym_add_change_count(1);
237 break; 237 break;
238 } 238 }
239 } else { 239 } else {
240 sym = sym_lookup(line + 9, 0); 240 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
241 if (sym->type == S_UNKNOWN) 241 if (sym->type == S_UNKNOWN)
242 sym->type = S_BOOLEAN; 242 sym->type = S_BOOLEAN;
243 } 243 }
@@ -253,8 +253,8 @@ load:
253 default: 253 default:
254 ; 254 ;
255 } 255 }
256 } else if (memcmp(line, "CONFIG_", 7) == 0) { 256 } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
257 p = strchr(line + 7, '='); 257 p = strchr(line + strlen(CONFIG_), '=');
258 if (!p) 258 if (!p)
259 continue; 259 continue;
260 *p++ = 0; 260 *p++ = 0;
@@ -265,13 +265,13 @@ load:
265 *p2 = 0; 265 *p2 = 0;
266 } 266 }
267 if (def == S_DEF_USER) { 267 if (def == S_DEF_USER) {
268 sym = sym_find(line + 7); 268 sym = sym_find(line + strlen(CONFIG_));
269 if (!sym) { 269 if (!sym) {
270 sym_add_change_count(1); 270 sym_add_change_count(1);
271 break; 271 break;
272 } 272 }
273 } else { 273 } else {
274 sym = sym_lookup(line + 7, 0); 274 sym = sym_lookup(line + strlen(CONFIG_), 0);
275 if (sym->type == S_UNKNOWN) 275 if (sym->type == S_UNKNOWN)
276 sym->type = S_OTHER; 276 sym->type = S_OTHER;
277 } 277 }
@@ -397,9 +397,9 @@ static void conf_write_string(bool headerfile, const char *name,
397{ 397{
398 int l; 398 int l;
399 if (headerfile) 399 if (headerfile)
400 fprintf(out, "#define CONFIG_%s \"", name); 400 fprintf(out, "#define %s%s \"", CONFIG_, name);
401 else 401 else
402 fprintf(out, "CONFIG_%s=\"", name); 402 fprintf(out, "%s%s=\"", CONFIG_, name);
403 403
404 while (1) { 404 while (1) {
405 l = strcspn(str, "\"\\"); 405 l = strcspn(str, "\"\\");
@@ -425,13 +425,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
425 switch (sym_get_tristate_value(sym)) { 425 switch (sym_get_tristate_value(sym)) {
426 case no: 426 case no:
427 if (write_no) 427 if (write_no)
428 fprintf(out, "# CONFIG_%s is not set\n", sym->name); 428 fprintf(out, "# %s%s is not set\n",
429 CONFIG_, sym->name);
429 break; 430 break;
430 case mod: 431 case mod:
431 fprintf(out, "CONFIG_%s=m\n", sym->name); 432 fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
432 break; 433 break;
433 case yes: 434 case yes:
434 fprintf(out, "CONFIG_%s=y\n", sym->name); 435 fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
435 break; 436 break;
436 } 437 }
437 break; 438 break;
@@ -441,7 +442,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
441 case S_HEX: 442 case S_HEX:
442 case S_INT: 443 case S_INT:
443 str = sym_get_string_value(sym); 444 str = sym_get_string_value(sym);
444 fprintf(out, "CONFIG_%s=%s\n", sym->name, str); 445 fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
445 break; 446 break;
446 case S_OTHER: 447 case S_OTHER:
447 case S_UNKNOWN: 448 case S_UNKNOWN:
@@ -832,14 +833,17 @@ int conf_write_autoconf(void)
832 case no: 833 case no:
833 break; 834 break;
834 case mod: 835 case mod:
835 fprintf(tristate, "CONFIG_%s=M\n", sym->name); 836 fprintf(tristate, "%s%s=M\n",
836 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); 837 CONFIG_, sym->name);
838 fprintf(out_h, "#define %s%s_MODULE 1\n",
839 CONFIG_, sym->name);
837 break; 840 break;
838 case yes: 841 case yes:
839 if (sym->type == S_TRISTATE) 842 if (sym->type == S_TRISTATE)
840 fprintf(tristate, "CONFIG_%s=Y\n", 843 fprintf(tristate,"%s%s=Y\n",
841 sym->name); 844 CONFIG_, sym->name);
842 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); 845 fprintf(out_h, "#define %s%s 1\n",
846 CONFIG_, sym->name);
843 break; 847 break;
844 } 848 }
845 break; 849 break;
@@ -849,12 +853,14 @@ int conf_write_autoconf(void)
849 case S_HEX: 853 case S_HEX:
850 str = sym_get_string_value(sym); 854 str = sym_get_string_value(sym);
851 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { 855 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
852 fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); 856 fprintf(out_h, "#define %s%s 0x%s\n",
857 CONFIG_, sym->name, str);
853 break; 858 break;
854 } 859 }
855 case S_INT: 860 case S_INT:
856 str = sym_get_string_value(sym); 861 str = sym_get_string_value(sym);
857 fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); 862 fprintf(out_h, "#define %s%s %s\n",
863 CONFIG_, sym->name, str);
858 break; 864 break;
859 default: 865 default:
860 break; 866 break;