Unify all assembler file generators
[openssl.git] / crypto / ppccpuid.pl
index 0c1e1247309585ee4f0c51513f27e47217681faa..de5d7e26679deeb9050ca25b7eaf1a07498b90f6 100755 (executable)
@@ -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";