summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-01-27 21:59:02 +0000
committerNicholas Clark <nick@ccl4.org>2009-01-27 21:59:02 +0000
commit4feb7f09863104b519a817212830509fc1dd677e (patch)
tree04602ccb3644c43670e1413a3172438dc1c37c48
parentb6922eda63cca3fefe5f447d156d10f6b75bd8eb (diff)
downloadperl-4feb7f09863104b519a817212830509fc1dd677e.tar.gz
In buildext.pl, refactor the @ARGV parsing into a single loop.
-rw-r--r--win32/buildext.pl43
1 files changed, 27 insertions, 16 deletions
diff --git a/win32/buildext.pl b/win32/buildext.pl
index f8cc432df2..675523d9e1 100644
--- a/win32/buildext.pl
+++ b/win32/buildext.pl
@@ -33,20 +33,35 @@ use FindExt;
use Config;
# @ARGV with '!' at first position are exclusions
-my %excl = map {$_=>1} map {/^!(.*)$/} @ARGV;
-@ARGV = grep {!/^!/} @ARGV;
# @ARGV with '+' at first position are inclusions
-my %incl = map {$_=>1} map {/^\+(.*)$/} @ARGV;
-@ARGV = grep {!/^\+/} @ARGV;
-
-# --static/--dynamic
-my %opts = map {$_=>1} map {/^--([\w\-]+)$/} @ARGV;
-@ARGV = grep {!/^--([\w\-]+)$/} @ARGV;
-my ($static,$dynamic) = ((exists $opts{static}?1:0),(exists $opts{dynamic}?1:0));
-if ("$static,$dynamic" eq "0,0") {
- ($static,$dynamic) = (1,1);
+# -- are long options.
+
+my %excl, %incl,
+my @argv;
+
+foreach (@ARGV) {
+ if (/^!(.*)$/) {
+ $excl{$1} = 1;
+ } elsif (/^\+(.*)$/) {
+ $incl{$1} = 1;
+ } elsif (/^--([\w\-]+)$/) {
+ $opts{$1} = 1;
+ } else {
+ push @argv, $_;
+ }
}
+my $static = $opts{static};
+my $dynamic = $opts{dynamic};
+
+$static = $dynamic = 1 unless $static or $dynamic;
+
+my $make = shift @argv;
+$make .= " " . shift @argv while $argv[0] =~ /^-/;
+my $dep = shift @argv;
+my $dir = shift @argv;
+my $targ = shift @argv;
+
(my $here = getcwd()) =~ s{/}{\\}g;
my $perl = $^X;
if ($perl =~ m#^\.\.#) {
@@ -61,13 +76,9 @@ unless (-f "$pl2bat.bat") {
print "@args\n";
system(@args) unless defined $::Cross::platform;
}
-my $make = shift;
-$make .= " ".shift while $ARGV[0]=~/^-/;
-my $dep = shift;
+
my $dmod = -M $dep;
-my $dir = shift;
chdir($dir) || die "Cannot cd to $dir\n";
-my $targ = shift;
(my $ext = getcwd()) =~ s{/}{\\}g;
my $code;
FindExt::scan_ext($ext);