summaryrefslogtreecommitdiff
path: root/v4l
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-17 19:18:52 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-17 19:18:52 -0300
commit02e41418e9e050031f77b1a2458cdc665a737019 (patch)
tree5348dbb124a369a149bafda0739508792600744f /v4l
parent167ec40d5f9fd58be2b1a605de47d0f4b8c2dda5 (diff)
downloadmediapointer-dvb-s2-02e41418e9e050031f77b1a2458cdc665a737019.tar.gz
mediapointer-dvb-s2-02e41418e9e050031f77b1a2458cdc665a737019.tar.bz2
Improve make_config.pl script
From: Mauro Carvalho Chehab <mchehab@infradead.org> This patch adds the capability of processing some tags that contains "if", like: menuconfig foo if bar boolean foo if bar tristate foo if bar default foo if bar Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l')
-rwxr-xr-xv4l/scripts/make_kconfig.pl47
1 files changed, 41 insertions, 6 deletions
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl
index b553a8a06..ee649f574 100755
--- a/v4l/scripts/make_kconfig.pl
+++ b/v4l/scripts/make_kconfig.pl
@@ -276,6 +276,7 @@ sub open_kconfig($$) {
my $disabled = 0;
my $in_help = 0;
my $default_seen = 0;
+ my $if;
print "Opening $file\n" if $debug;
open $in, '<', $file or die "File not found: $file";
@@ -314,6 +315,7 @@ sub open_kconfig($$) {
$disabled = 0;
$default_seen = 0;
$key = undef;
+ $if = "";
}
next if (/^\s*#/ || /^\s*$/); # skip comments and blank lines
@@ -327,6 +329,7 @@ sub open_kconfig($$) {
my $nothandled = 0;
if (m|^\s*(?:menu)?config (\w+)\s*$|) {
$key = $1;
+ $if = "";
print "Found config '$key' at $file:$.\n" if $debug;
add_config($key);
@@ -382,8 +385,24 @@ sub open_kconfig($$) {
# config type
if(/^\s*bool(ean)?\s/) {
add_bool($key);
+ if (m|if (.*)\s*$|) {
+ printf("Boolean $key with if '$1'\n") if $debug;
+ if ($if eq "") {
+ $if = "($1)";
+ } else {
+ $if .= " && ($1)";
+ }
+ }
} elsif (/^\s*tristate\s/) {
add_tristate($key);
+ if (m|if (.*)\s*$|) {
+ printf("Boolean $key with if '$1'\n") if $debug;
+ if ($if eq "") {
+ $if = "($1)";
+ } else {
+ $if .= " && ($1)";
+ }
+ }
} elsif (/^\s*int\s/) {
add_int($key);
} elsif (/^\s*hex\s/) {
@@ -400,6 +419,14 @@ sub open_kconfig($$) {
# default lines
} elsif (m|^\s*default\s+(.+?)(?:\s+if .*)?\s*$|) {
my $o = $1;
+ if ($2 ne "") {
+ if ($if eq "") {
+ $if = "($2)";
+ } else {
+ $if .= " && ($2)";
+ }
+ }
+
# Get default for int options
if ($o =~ m|^"(\d+)"$| && exists $intopt{$key}) {
set_int_value($key, $1);
@@ -412,13 +439,21 @@ sub open_kconfig($$) {
# Override default for disabled tri/bool options
# We don't care about the default for tri/bool options otherwise
- } elsif ($o =~ /^(y|n|m|"yes"|"no")$/i && exists $tristate{$key}) {
- if ($disabled) {
- $default_seen = 1;
- $_ = "\tdefault n\n";
+ } elsif (!$o =~ /^(y|n|m|"yes"|"no")$/i && exists $tristate{$key}) {
+ print "Default is an expression at $file:$. $_\n" if $debug;
+ if ($if eq "") {
+ depends($key, "$o");
}
- } else {
- print "Unknown default at $file:$. $_\n" if $debug;
+ }
+ if ($if ne "") {
+ # FIXME: What happens if no default clause exists?
+ # the $if won't be handled
+ depends($key, "$if || $o");
+ }
+
+ if ($disabled) {
+ $default_seen = 1;
+ $_ = "\tdefault n\n";
}
} else {
print "Skipping $file:$. $_" if $debug;