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