mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-16 01:38:22 +00:00
cd51878e34
The sed script, tools/scripts/define2mk.sed, converts config defines from C headers into include/autoconf.mk for the use in Makefiles. I found the tool adds quotes around negative integer values. For example, at the point of the v2016.07-rc1 tag, include/configs/microblaze-generic.h defines #define CONFIG_BOOTDELAY -1 /* -1 disables auto-boot */ Because it is an integer option, it should be converted to: CONFIG_BOOTDELAY=-1 But, the script actually converts it to: CONFIG_BOOTDELAY="-1" This is a fatal problem for the tools/moveconfig.py because it parses include/autoconf.mk for the config defines from the board headers. CONFIG_BOOTDELAY="-1" is considered as a string type option and it is dropped due to the type mismatch from the entry in Kconfig. This commit fixes the script so that the tools/moveconfig.py can correctly convert integer options with a negative value. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
37 lines
1.1 KiB
Sed
37 lines
1.1 KiB
Sed
#
|
|
# Sed script to parse CPP macros and generate output usable by make
|
|
#
|
|
# It is expected that this script is fed the output of 'gpp -dM'
|
|
# which preprocesses the common.h header files and outputs the final
|
|
# list of CPP macros (and whitespace is sanitized)
|
|
#
|
|
|
|
# Only process values prefixed with #define CONFIG_
|
|
/^#define CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*/ {
|
|
# Strip the #define prefix
|
|
s/#define *//;
|
|
# Change to form CONFIG_*=VALUE
|
|
s/ */=/;
|
|
# Drop trailing spaces
|
|
s/ *$//;
|
|
# drop quotes around string values
|
|
s/="\(.*\)"$/=\1/;
|
|
# Concatenate string values
|
|
s/" *"//g;
|
|
# Assume strings as default - add quotes around values
|
|
s/=\(..*\)/="\1"/;
|
|
# but remove again from decimal numbers
|
|
s/="\([0-9][0-9]*\)"/=\1/;
|
|
# ... and from negative decimal numbers
|
|
s/="\(-[1-9][0-9]*\)"/=\1/;
|
|
# ... and from hex numbers
|
|
s/="\(0[Xx][0-9a-fA-F][0-9a-fA-F]*\)"/=\1/;
|
|
# ... and from configs defined from other configs
|
|
s/="\(CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*\)"/=$(\1)/;
|
|
# Change '1' and empty values to "y" (not perfect, but
|
|
# supports conditional compilation in the makefiles
|
|
s/=$/=y/;
|
|
s/=1$/=y/;
|
|
# print the line
|
|
p
|
|
}
|