diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-14 17:59:02 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-14 17:59:02 -0800 |
commit | 1e6c4dfdeb040b2dd5c4d6d803ab95c3971ad80c (patch) | |
tree | 594366f7c9e9ab8a54d2b82121c8802b1950ead6 /scripts | |
parent | 51be08419dc86c72486ac556aa39bc01026a403d (diff) | |
parent | 364212fddaaa60c5a64f67a0f5624ad996ecc8a0 (diff) | |
download | linux-1e6c4dfdeb040b2dd5c4d6d803ab95c3971ad80c.tar.gz linux-1e6c4dfdeb040b2dd5c4d6d803ab95c3971ad80c.tar.bz2 linux-1e6c4dfdeb040b2dd5c4d6d803ab95c3971ad80c.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-kconfig
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-kconfig:
kconfig/streamline-config.pl: Fix parsing Makefile with variables
kconfig/streamline-config.pl: Simplify backslash line concatination
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/streamline_config.pl | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index ec7afce4c88d..bccf07ddd0b6 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl @@ -250,33 +250,61 @@ if ($kconfig) { read_kconfig($kconfig); } +sub convert_vars { + my ($line, %vars) = @_; + + my $process = ""; + + while ($line =~ s/^(.*?)(\$\((.*?)\))//) { + my $start = $1; + my $variable = $2; + my $var = $3; + + if (defined($vars{$var})) { + $process .= $start . $vars{$var}; + } else { + $process .= $start . $variable; + } + } + + $process .= $line; + + return $process; +} + # Read all Makefiles to map the configs to the objects foreach my $makefile (@makefiles) { - my $cont = 0; + my $line = ""; + my %make_vars; open(MIN,$makefile) || die "Can't open $makefile"; while (<MIN>) { + # if this line ends with a backslash, continue + chomp; + if (/^(.*)\\$/) { + $line .= $1; + next; + } + + $line .= $_; + $_ = $line; + $line = ""; + my $objs; - # is this a line after a line with a backslash? - if ($cont && /(\S.*)$/) { - $objs = $1; - } - $cont = 0; + $_ = convert_vars($_, %make_vars); # collect objects after obj-$(CONFIG_FOO_BAR) if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { $var = $1; $objs = $2; + + # check if variables are set + } elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) { + $make_vars{$1} = $2; } if (defined($objs)) { - # test if the line ends with a backslash - if ($objs =~ m,(.*)\\$,) { - $objs = $1; - $cont = 1; - } - foreach my $obj (split /\s+/,$objs) { $obj =~ s/-/_/g; if ($obj =~ /(.*)\.o$/) { |