target/sdk: generate a Config.in file with the settings of the build that the SDK was generated from
[openwrt.org/openwrt.git] / target / sdk / convert-config.pl
blob:a/target/sdk/convert-config.pl -> blob:b/target/sdk/convert-config.pl
#!/usr/bin/env perl #!/usr/bin/env perl
use strict; use strict;
   
  print <<EOF;
  config ALL
  bool
  default y
   
  EOF
   
while (<>) { while (<>) {
chomp; chomp;
  next if /^CONFIG_SIGNED_PACKAGES/;
next unless /^CONFIG_([^=]+)=(.*)$/; next unless /^CONFIG_([^=]+)=(.*)$/;
   
my $var = $1; my $var = $1;
my $val = $2; my $val = $2;
my $type; my $type;
   
  next if $var eq 'ALL';
   
if ($val eq 'y') { if ($val eq 'y') {
$type = "bool"; $type = "bool";
} elsif ($val eq 'm') { } elsif ($val eq 'm') {
$type = "tristate"; $type = "tristate";
} elsif ($val =~ /^".*"$/) { } elsif ($val =~ /^".*"$/) {
$type = "string"; $type = "string";
} elsif ($val =~ /^\d+$/) { } elsif ($val =~ /^\d+$/) {
$type = "int"; $type = "int";
} else { } else {
warn "WARNING: no type found for symbol CONFIG_$var=$val\n"; warn "WARNING: no type found for symbol CONFIG_$var=$val\n";
next; next;
} }
   
print <<EOF; print <<EOF;
config $var config $var
$type $type
default $val default $val
   
EOF EOF
} }
   
comments