Upload Tizen:Base source
[toolchains/build.git] / getoptflags
1 #!/usr/bin/perl -w
2
3 BEGIN {
4   unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
5 }
6
7 use strict;
8
9 use Build;
10
11 my ($dist, $archs, $configdir, $debug);
12
13 while (@ARGV)  {
14   if ($ARGV[0] eq '--dist') {
15     shift @ARGV;
16     $dist = shift @ARGV;
17     next;
18   }
19   if ($ARGV[0] eq '--archpath') {
20     shift @ARGV;
21     $archs = shift @ARGV;
22     next;
23   }
24   if ($ARGV[0] eq '--configdir') {
25     shift @ARGV;
26     $configdir = shift @ARGV;
27     next;
28   }
29   if ($ARGV[0] eq '--debug') {
30     shift @ARGV;
31     $debug = 1;
32     next;
33   }
34   last;
35 }
36
37 die("Usage: getoptflags --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
38
39 my $cf = Build::read_config_dist($dist, $archs, $configdir);
40 exit 0 unless $cf->{'optflags'};
41 my $all = $cf->{'optflags'}->{'*'};
42 $all = defined($all) && $all ne '' ? " $all" : '';
43 $all .= " -g" if $debug;
44 for (sort keys %{$cf->{'optflags'}}) {
45   next if $_ eq '*';
46   print "optflags: $_ $cf->{'optflags'}->{$_}$all\n";
47 }