aa97f8d60379076a41b968402e9337cea824ece5
7 my (%targets, %architectures);
9 $ENV{'TOPDIR'} = Cwd
::getcwd
();
12 sub parse_targetinfo
{
13 my ($target_dir, $subtarget) = @_;
15 if (open M
, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 SUBTARGET='$subtarget' |") {
16 my ($target_name, $target_arch, @target_features);
17 while (defined(my $line = readline M
)) {
20 if ($line =~ /^Target: (.+)$/) {
23 elsif ($line =~ /^Target-Arch-Packages: (.+)$/) {
26 elsif ($line =~ /^Target-Features: (.+)$/) {
27 @target_features = split /\s+/, $1;
29 elsif ($line =~ /^@\@$/) {
30 if ($target_name && $target_arch &&
31 !grep { $_ eq 'broken' or $_ eq 'source-only' } @target_features) {
32 $targets{$target_name} = $target_arch;
33 $architectures{$target_arch} ||= [];
34 push @
{$architectures{$target_arch}}, $target_name;
39 @target_features = ();
47 foreach my $target_makefile (glob "target/linux/*/Makefile") {
48 my ($target_dir) = $target_makefile =~ m!^(.+)/Makefile$!;
51 if (open M
, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 val.FEATURES V=s 2>/dev/null |") {
52 if (defined(my $line = readline M
)) {
54 if (grep { $_ eq 'broken' or $_ eq 'source-only' } split /\s+/, $line) {
60 if (open M
, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 val.SUBTARGETS V=s 2>/dev/null |") {
61 if (defined(my $line = readline M
)) {
63 @subtargets = split /\s+/, $line;
68 push @subtargets, 'generic' if @subtargets == 0;
70 foreach my $subtarget (@subtargets) {
71 parse_targetinfo
($target_dir, $subtarget);
76 if (@ARGV == 1 && $ARGV[0] eq 'targets') {
78 foreach my $target_name (sort keys %targets) {
79 printf "%s %s\n", $target_name, $targets{$target_name};
82 elsif (@ARGV == 1 && $ARGV[0] eq 'architectures') {
84 foreach my $target_arch (sort keys %architectures) {
85 printf "%s %s\n", $target_arch, join ' ', @
{$architectures{$target_arch}};
89 print "Usage: $0 targets\n";
90 print "Usage: $0 architectures\n";