Unify all assembler file generators
[openssl.git] / crypto / poly1305 / asm / poly1305-mips.pl
index 65d6b5cdf3b6736efa1d5c22609f88cb1d367d4a..a2504347c236b1c2fccff3723a1f838e9fbc97a7 100755 (executable)
 #
 ######################################################################
 
-$flavour = shift || "o32"; # supported flavours are o32,n32,64,nubi32,nubi64
+# $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;
+# supported flavours are o32,n32,64,nubi32,nubi64, default is o32
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : "o32";
 
 die "MIPS64 only" unless ($flavour =~ /64|n32/i);
 
@@ -431,7 +435,7 @@ poly1305_emit:
 ___
 }
 
-$output=pop and open STDOUT,">$output";
+$output and open STDOUT,">$output";
 print $code;
 close STDOUT;