diff options
Diffstat (limited to 'v4l/scripts/make_noconfig.pl')
-rwxr-xr-x | v4l/scripts/make_noconfig.pl | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/v4l/scripts/make_noconfig.pl b/v4l/scripts/make_noconfig.pl index cb3ea9627..7323f419c 100755 --- a/v4l/scripts/make_noconfig.pl +++ b/v4l/scripts/make_noconfig.pl @@ -1,5 +1,13 @@ #!/usr/bin/perl +# The purpose of this script is to produce a file named '.myconfig', in +# the same style as the '.config' file. Except .myconfig has disabled +# options explicitly set to 'n' rather than just omitted. This is to +# make sure they override any corresponding options that may be turned on +# in the Kernel's config files. +# The .myconfig file is what will be included in the v4l-dvb Makefile +# to control which drivers are built. + my %config = (); my %allconfig = (); @@ -13,9 +21,11 @@ while (<IN>) { close IN; # Build table of _all_ bool and tristate config variables +my $key = 0; open IN,"Kconfig"; while (<IN>) { if (/^config\s+(\w+)\s*$/) { + $key == 0 or die "Couldn't find type of config '$key'"; $key = "CONFIG_$1"; } elsif (/^\s+bool(ean)?\s/) { $allconfig{$key} = 'bool'; @@ -23,18 +33,26 @@ while (<IN>) { } elsif (/^\s+tristate\s/) { $allconfig{$key} = 'tristate'; $key = 0; + } elsif (/^\s+(int|hex|string)\s/) { + $allconfig{$key} = 'data'; + $key = 0; } - # else, must be int or string, ignore } close IN; exists $allconfig{0} and die "Unable to correctly parse Kconfig file"; # Produce output for including in a Makefile -# Explicitly set options that didn't appear in .config to n +# Explicitly set bool/tri options that didn't appear in .config to n +# 'data' options are only output if they appeared in .config open OUT,">.myconfig"; while ( my ($key, $value) = each(%allconfig) ) { - $value = exists $config{$key} ? $config{$key} : 'n'; + if ($value eq 'data') { + next unless (exists $config{$key}); + $value = $config{$key}; + } else { + $value = exists $config{$key} ? $config{$key} : 'n'; + } printf OUT "%-44s := %s\n",$key,$value; } close OUT; |