Unify all assembler file generators
[openssl.git] / crypto / aes / asm / aesni-sha256-x86_64.pl
index e182ecc55a98d77a77b48741305efc690de9fbd2..0a1dec777bc673e3fd35210d5415fd873b29d561 100644 (file)
 #      -evp aes-256-cbc-hmac-sha256' will vary by percent or two;
 # (***)        these are SHAEXT results;
 
-$flavour = shift;
-$output  = shift;
-if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
+# $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;
 
 $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
 
@@ -77,7 +78,8 @@ if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([
 $shaext=$avx;  ### set to zero if compiling for 1.0.1
 $avx=1         if (!$shaext && $avx);
 
-open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\"";
+open OUT,"| \"$^X\" \"$xlate\" $flavour \"$output\""
+    or die "can't call $xlate: $!";
 *STDOUT=*OUT;
 
 $func="aesni_cbc_sha256_enc";