3 # Copyright (C) 2006 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
20 while ($opt = shift @ARGV) {
21 $opt =~ /^-s/ and $options{SDK} = 1;
27 $line =~ /^Source-Makefile: \s*(.+\/([^\/]+)\/Makefile)\s*$/ and do {
31 $line =~ /^Package: \s*(.+)\s*$/ and do {
33 defined $pkg{$name} or $pkg{$name} = {};
34 $pkg{$name}->{src} = $src;
36 $line =~ /^(Build-)?Depends: \s*(.+)\s*$/ and do {
37 $pkg{$name}->{depends} ||= [];
38 foreach my $v (split /\s+/, $2) {
39 next if $v =~ /^[\+]?@/;
41 push @{$pkg{$name}->{depends}}, $v;
48 foreach $name (sort {uc($a) cmp uc($b)} keys %pkg) {
50 $conf{$pkg{$name}->{src}} or print "package-m += $pkg{$name}->{src}\n";
51 $conf{$pkg{$name}->{src}} = 1;
53 print "package-\$(CONFIG_PACKAGE_$name) += $pkg{$name}->{src}\n";
58 foreach my $dep (@{$pkg{$name}->{depends}}) {
60 if (defined $pkg{$dep}->{src}) {
61 ($pkg{$name}->{src} ne $pkg{$dep}->{src}) and $idx = $pkg{$dep}->{src};
62 } elsif (defined($pkg{$dep}) && !$options{SDK}) {
66 next if $dep{$pkg{$name}->{src}."->".$idx};
67 $depline .= " $idx\-compile";
68 $dep{$pkg{$name}->{src}."->".$idx} = 1;
72 $line .= "$pkg{$name}->{src}-compile: $depline\n";