aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-01-13 17:53:40 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-25 20:24:47 -0500
commitadc0186cfa38e2736048a638681db511e65e51fd (patch)
treef103524ac9031f799b099b4675749a97cc702ab6
parente5303c25bfacd745f6c6b99a2604ef4e11926c34 (diff)
kconfig/streamline-config.pl: Fix parsing Makefile with variables
commit 364212fddaaa60c5a64f67a0f5624ad996ecc8a0 upstream. Thomas Lange reported that when he did a 'make localmodconfig', his config was missing the brcmsmac driver, even though he had the module loaded. Looking into this, I found the file: drivers/net/wireless/brcm80211/brcmsmac/Makefile had the following in the Makefile: MODULEPFX := brcmsmac obj-$(CONFIG_BRCMSMAC) += $(MODULEPFX).o The way streamline-config.pl works, is parsing all the obj-$(CONFIG_FOO) += foo.o lines to find that CONFIG_FOO belongs to the module foo.ko. But in this case, the brcmsmac.o was not used, but a variable in its place. By changing streamline-config.pl to remember defined variables in Makefiles and substituting them when they are used in the obj-X lines, allows Thomas (and others) to have their brcmsmac module stay configured when it is loaded and running "make localmodconfig". Reported-by: Thomas Lange <thomas-lange2@gmx.de> Tested-by: Thomas Lange <thomas-lange2@gmx.de> Cc: Arend van Spriel <arend@broadcom.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--scripts/kconfig/streamline_config.pl29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index f25809200a9..25f1e71c9bb 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -242,10 +242,33 @@ if ($kconfig) {
242 read_kconfig($kconfig); 242 read_kconfig($kconfig);
243} 243}
244 244
245sub convert_vars {
246 my ($line, %vars) = @_;
247
248 my $process = "";
249
250 while ($line =~ s/^(.*?)(\$\((.*?)\))//) {
251 my $start = $1;
252 my $variable = $2;
253 my $var = $3;
254
255 if (defined($vars{$var})) {
256 $process .= $start . $vars{$var};
257 } else {
258 $process .= $start . $variable;
259 }
260 }
261
262 $process .= $line;
263
264 return $process;
265}
266
245# Read all Makefiles to map the configs to the objects 267# Read all Makefiles to map the configs to the objects
246foreach my $makefile (@makefiles) { 268foreach my $makefile (@makefiles) {
247 269
248 my $line = ""; 270 my $line = "";
271 my %make_vars;
249 272
250 open(MIN,$makefile) || die "Can't open $makefile"; 273 open(MIN,$makefile) || die "Can't open $makefile";
251 while (<MIN>) { 274 while (<MIN>) {
@@ -262,10 +285,16 @@ foreach my $makefile (@makefiles) {
262 285
263 my $objs; 286 my $objs;
264 287
288 $_ = convert_vars($_, %make_vars);
289
265 # collect objects after obj-$(CONFIG_FOO_BAR) 290 # collect objects after obj-$(CONFIG_FOO_BAR)
266 if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { 291 if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
267 $var = $1; 292 $var = $1;
268 $objs = $2; 293 $objs = $2;
294
295 # check if variables are set
296 } elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) {
297 $make_vars{$1} = $2;
269 } 298 }
270 if (defined($objs)) { 299 if (defined($objs)) {
271 foreach my $obj (split /\s+/,$objs) { 300 foreach my $obj (split /\s+/,$objs) {