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