summaryrefslogtreecommitdiffstats
path: root/crypto/ppccpuid.pl
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ppccpuid.pl')
-rwxr-xr-xcrypto/ppccpuid.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/ppccpuid.pl b/crypto/ppccpuid.pl
index 0c1e124730..de5d7e2667 100755
--- a/crypto/ppccpuid.pl
+++ b/crypto/ppccpuid.pl
@@ -7,14 +7,18 @@
# https://www.openssl.org/source/license.html
-$flavour = shift;
+# $output is the last argument if it looks like a file (it has an extension)
+# $flavour is the first argument if it doesn't look like a file
+$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
( $xlate="${dir}ppc-xlate.pl" and -f $xlate ) or
( $xlate="${dir}perlasm/ppc-xlate.pl" and -f $xlate) or
die "can't locate ppc-xlate.pl";
-open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!";
+open STDOUT,"| $^X $xlate $flavour \"$output\""
+ or die "can't call $xlate: $!";
if ($flavour=~/64/) {
$CMPLI="cmpldi";