target/sdk: generate a Config.in file with the settings of the build that the SDK...
[openwrt/staging/stintel.git] / target / sdk / convert-config.pl
1 #!/usr/bin/env perl
2 use strict;
3
4 while (<>) {
5 chomp;
6 next unless /^CONFIG_([^=]+)=(.*)$/;
7
8 my $var = $1;
9 my $val = $2;
10 my $type;
11
12 if ($val eq 'y') {
13 $type = "bool";
14 } elsif ($val eq 'm') {
15 $type = "tristate";
16 } elsif ($val =~ /^".*"$/) {
17 $type = "string";
18 } elsif ($val =~ /^\d+$/) {
19 $type = "int";
20 } else {
21 warn "WARNING: no type found for symbol CONFIG_$var=$val\n";
22 next;
23 }
24
25 print <<EOF;
26 config $var
27 $type
28 default $val
29
30 EOF
31 }