blob: cb3ea962781e67bb4100a05c174d6a24769da62a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/perl
my %config = ();
my %allconfig = ();
open IN,".config";
while (<IN>) {
if (m/\s*(\w+)=\s*(\S*)/) {
#printf "%s=%s\n",$1,$2;
$config { $1 } = $2;
}
}
close IN;
# Build table of _all_ bool and tristate config variables
open IN,"Kconfig";
while (<IN>) {
if (/^config\s+(\w+)\s*$/) {
$key = "CONFIG_$1";
} elsif (/^\s+bool(ean)?\s/) {
$allconfig{$key} = 'bool';
$key = 0;
} elsif (/^\s+tristate\s/) {
$allconfig{$key} = 'tristate';
$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
open OUT,">.myconfig";
while ( my ($key, $value) = each(%allconfig) ) {
$value = exists $config{$key} ? $config{$key} : 'n';
printf OUT "%-44s := %s\n",$key,$value;
}
close OUT;
|