aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/streamline_config.pl
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 17:43:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-29 17:43:30 -0400
commitb7bdcc47114595b4b359fe0f7d941bb901e9261d (patch)
treeeab66a18536e6db6f3e465619440d1141ca18ba4 /scripts/kconfig/streamline_config.pl
parent1840897ab5d39b2e510c610ee262ded79919e718 (diff)
parent8ef17fa2ef8be74b946e725c2afb0e2a54981da1 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-kconfig: kconfig: Have streamline_config process menuconfigs too kconfig: Fix streamline_config to read multi line deps in Kconfig files kconfig: Fix missing declaration of variable $dir in streamline_config.pl kconfig: Fix variable name typo %prompts in streamline_config.pl kconfig: Make localmodconfig handle environment variables
Diffstat (limited to 'scripts/kconfig/streamline_config.pl')
-rw-r--r--scripts/kconfig/streamline_config.pl43
1 files changed, 36 insertions, 7 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index c70a27d924f0..fd81fc33d633 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -42,6 +42,8 @@
42# mv config_strip .config 42# mv config_strip .config
43# make oldconfig 43# make oldconfig
44# 44#
45use strict;
46
45my $config = ".config"; 47my $config = ".config";
46 48
47my $uname = `uname -r`; 49my $uname = `uname -r`;
@@ -123,7 +125,6 @@ my %selects;
123my %prompts; 125my %prompts;
124my %objects; 126my %objects;
125my $var; 127my $var;
126my $cont = 0;
127my $iflevel = 0; 128my $iflevel = 0;
128my @ifdeps; 129my @ifdeps;
129 130
@@ -137,19 +138,45 @@ sub read_kconfig {
137 my $config; 138 my $config;
138 my @kconfigs; 139 my @kconfigs;
139 140
140 open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig"; 141 my $cont = 0;
142 my $line;
143
144 my $source = "$ksource/$kconfig";
145 my $last_source = "";
146
147 # Check for any environment variables used
148 while ($source =~ /\$(\w+)/ && $last_source ne $source) {
149 my $env = $1;
150 $last_source = $source;
151 $source =~ s/\$$env/$ENV{$env}/;
152 }
153
154 open(KIN, "$source") || die "Can't open $kconfig";
141 while (<KIN>) { 155 while (<KIN>) {
142 chomp; 156 chomp;
143 157
158 # Make sure that lines ending with \ continue
159 if ($cont) {
160 $_ = $line . " " . $_;
161 }
162
163 if (s/\\$//) {
164 $cont = 1;
165 $line = $_;
166 next;
167 }
168
169 $cont = 0;
170
144 # collect any Kconfig sources 171 # collect any Kconfig sources
145 if (/^source\s*"(.*)"/) { 172 if (/^source\s*"(.*)"/) {
146 $kconfigs[$#kconfigs+1] = $1; 173 $kconfigs[$#kconfigs+1] = $1;
147 } 174 }
148 175
149 # configs found 176 # configs found
150 if (/^\s*config\s+(\S+)\s*$/) { 177 if (/^\s*(menu)?config\s+(\S+)\s*$/) {
151 $state = "NEW"; 178 $state = "NEW";
152 $config = $1; 179 $config = $2;
153 180
154 for (my $i = 0; $i < $iflevel; $i++) { 181 for (my $i = 0; $i < $iflevel; $i++) {
155 if ($i) { 182 if ($i) {
@@ -178,7 +205,7 @@ sub read_kconfig {
178 # configs without prompts must be selected 205 # configs without prompts must be selected
179 } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { 206 } elsif ($state ne "NONE" && /^\s*tristate\s\S/) {
180 # note if the config has a prompt 207 # note if the config has a prompt
181 $prompt{$config} = 1; 208 $prompts{$config} = 1;
182 209
183 # Check for if statements 210 # Check for if statements
184 } elsif (/^if\s+(.*\S)\s*$/) { 211 } elsif (/^if\s+(.*\S)\s*$/) {
@@ -218,6 +245,8 @@ if ($kconfig) {
218# Read all Makefiles to map the configs to the objects 245# Read all Makefiles to map the configs to the objects
219foreach my $makefile (@makefiles) { 246foreach my $makefile (@makefiles) {
220 247
248 my $cont = 0;
249
221 open(MIN,$makefile) || die "Can't open $makefile"; 250 open(MIN,$makefile) || die "Can't open $makefile";
222 while (<MIN>) { 251 while (<MIN>) {
223 my $objs; 252 my $objs;
@@ -281,7 +310,7 @@ if (defined($lsmod_file)) {
281 # see what modules are loaded on this system 310 # see what modules are loaded on this system
282 my $lsmod; 311 my $lsmod;
283 312
284 foreach $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { 313 foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) {
285 if ( -x "$dir/lsmod" ) { 314 if ( -x "$dir/lsmod" ) {
286 $lsmod = "$dir/lsmod"; 315 $lsmod = "$dir/lsmod";
287 last; 316 last;
@@ -363,7 +392,7 @@ while ($repeat) {
363 parse_config_dep_select $depends{$config}; 392 parse_config_dep_select $depends{$config};
364 } 393 }
365 394
366 if (defined($prompt{$config}) || !defined($selects{$config})) { 395 if (defined($prompts{$config}) || !defined($selects{$config})) {
367 next; 396 next;
368 } 397 }
369 398