Added some more comments and cleaned up part of the the code to use a named variable instead of one of the special $1 perl variables. No functional changes.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -186,6 +186,7 @@ sub read_kconfig { · 185 unmodified lines | ||
| 186 | 186 | $state = "NEW"; |
| 187 | 187 | $config = $2; |
| 188 | 188 | |
| 189 | + # Add depends for 'if' nesting | |
| 189 | 190 | for (my $i = 0; $i < $iflevel; $i++) { |
| 190 | 191 | if ($i) { |
| 191 | 192 | $depends{$config} .= " " . $ifdeps[$i]; |
| @@ -204,10 +205,11 @@ sub read_kconfig { · 12 unmodified lines | ||
| 204 | 205 | |
| 205 | 206 | # Get the configs that select this config |
| 206 | 207 | } elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) { |
| 207 | − if (defined($selects{$1})) { | |
| 208 | − $selects{$1} .= " " . $config; | |
| 208 | + my $conf = $1; | |
| 209 | + if (defined($selects{$conf})) { | |
| 210 | + $selects{$conf} .= " " . $config; | |
| 209 | 211 | } else { |
| 210 | − $selects{$1} = $config; | |
| 212 | + $selects{$conf} = $config; | |
| 211 | 213 | } |
| 212 | 214 | |
| 213 | 215 | # configs without prompts must be selected |
| @@ -250,6 +252,7 @@ if ($kconfig) { · 36 unmodified lines | ||
| 250 | 252 | read_kconfig($kconfig); |
| 251 | 253 | } |
| 252 | 254 | |
| 255 | +# Makefiles can use variables to define their dependencies | |
| 253 | 256 | sub convert_vars { |
| 254 | 257 | my ($line, %vars) = @_; |
| 255 | 258 | |
| @@ -293,6 +296,7 @@ foreach my $makefile (@makefiles) { · 37 unmodified lines | ||
| 293 | 296 | |
| 294 | 297 | my $objs; |
| 295 | 298 | |
| 299 | + # Convert variables in a line (could define configs) | |
| 296 | 300 | $_ = convert_vars($_, %make_vars); |
| 297 | 301 | |
| 298 | 302 | # collect objects after obj-$(CONFIG_FOO_BAR) |
| @@ -373,7 +377,8 @@ while (<LIN>) { · 74 unmodified lines | ||
| 373 | 377 | close (LIN); |
| 374 | 378 | |
| 375 | 379 | # add to the configs hash all configs that are needed to enable |
| 376 | −# a loaded module. | |
| 380 | +# a loaded module. This is a direct obj-${CONFIG_FOO} += bar.o | |
| 381 | +# where we know we need bar.o so we add FOO to the list. | |
| 377 | 382 | my %configs; |
| 378 | 383 | foreach my $module (keys(%modules)) { |
| 379 | 384 | if (defined($objects{$module})) { |