Unified - adapt the generation of aes assembler to use GENERATE
authorRichard Levitte <levitte@openssl.org>
Mon, 7 Mar 2016 14:07:35 +0000 (15:07 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 9 Mar 2016 10:09:26 +0000 (11:09 +0100)
This gets rid of the BEGINRAW..ENDRAW sections in crypto/aes/build.info.

This also moves the assembler generating perl scripts to take the
output file name as last command line argument, where necessary.

Reviewed-by: Andy Polyakov <appro@openssl.org>
crypto/aes/Makefile.in
crypto/aes/asm/aes-586.pl
crypto/aes/asm/aesni-x86.pl
crypto/aes/asm/vpaes-x86.pl
crypto/aes/build.info

index 6ece34378af691d70e3eb10b54dc7bfcacf78d8e..0439245458be712016c77645bd00c67562de3a5a 100644 (file)
@@ -45,26 +45,26 @@ aes-ia64.s: asm/aes-ia64.S
        $(CC) $(CFLAGS) -E asm/aes-ia64.S > $@
 
 aes-586.s:     asm/aes-586.pl ../perlasm/x86asm.pl
-       $(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
+       $(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 vpaes-x86.s:   asm/vpaes-x86.pl ../perlasm/x86asm.pl
-       $(PERL) asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
+       $(PERL) asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 aesni-x86.s:   asm/aesni-x86.pl ../perlasm/x86asm.pl
-       $(PERL) asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
+       $(PERL) asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 
 aes-x86_64.s: asm/aes-x86_64.pl
-       $(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) $@
 vpaes-x86_64.s:        asm/vpaes-x86_64.pl
-       $(PERL) asm/vpaes-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/vpaes-x86_64.pl $(PERLASM_SCHEME) $@
 bsaes-x86_64.s:        asm/bsaes-x86_64.pl
-       $(PERL) asm/bsaes-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/bsaes-x86_64.pl $(PERLASM_SCHEME) $@
 aesni-x86_64.s: asm/aesni-x86_64.pl
-       $(PERL) asm/aesni-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/aesni-x86_64.pl $(PERLASM_SCHEME) $@
 aesni-sha1-x86_64.s:   asm/aesni-sha1-x86_64.pl
-       $(PERL) asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME) $@
 aesni-sha256-x86_64.s: asm/aesni-sha256-x86_64.pl
-       $(PERL) asm/aesni-sha256-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/aesni-sha256-x86_64.pl $(PERLASM_SCHEME) $@
 aesni-mb-x86_64.s:     asm/aesni-mb-x86_64.pl
-       $(PERL) asm/aesni-mb-x86_64.pl $(PERLASM_SCHEME) $@
+       $(PERL) asm/aesni-mb-x86_64.pl $(PERLASM_SCHEME) $@
 
 aes-sparcv9.S: asm/aes-sparcv9.pl
        $(PERL) asm/aes-sparcv9.pl $(PERLASM_SCHEME) $@
index 767f2042623d0b5452edb0544760cc5deb3b0a2b..5a7f1b4551bcb3f727fd98590589993094881d5f 100755 (executable)
@@ -191,6 +191,10 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open OUT,">$output";
+*STDOUT=*OUT;
+
 &asm_init($ARGV[0],"aes-586.pl",$x86only = $ARGV[$#ARGV] eq "386");
 &static_label("AES_Te");
 &static_label("AES_Td");
@@ -2985,3 +2989,5 @@ sub deckey()
 &asciz("AES for x86, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
+
+close STDOUT;
index 536f0359f1a4f6a30414c0af036bbc0b49f86ec1..b85d0c425b8edb1a41584d033a489c35b6fc90d1 100644 (file)
@@ -67,6 +67,10 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open OUT,">$output";
+*STDOUT=*OUT;
+
 &asm_init($ARGV[0],$0);
 
 &external_label("OPENSSL_ia32cap_P");
@@ -3398,3 +3402,5 @@ my ($l_,$block,$i1,$i3,$i5) = ($rounds_,$key_,$rounds,$len,$out);
 &asciz("AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>");
 
 &asm_finish();
+
+close STDOUT;
index 2ba149c3f9d599ce87516672ab9cea657395b4ef..4fcd561592a7e9ee5f96d8d92abf804083e0a847 100644 (file)
@@ -51,6 +51,10 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output = pop;
+open OUT,">$output";
+*STDOUT=*OUT;
+
 &asm_init($ARGV[0],"vpaes-x86.pl",$x86only = $ARGV[$#ARGV] eq "386");
 
 $PREFIX="vpaes";
@@ -901,3 +905,5 @@ $k_dsbo=0x2c0;              # decryption sbox final output
 &function_end("${PREFIX}_cbc_encrypt");
 
 &asm_finish();
+
+close STDOUT;
index 40e01d3424086d2948fd7f7dd545655ac5f03d31..3328abc25ab3076394052dec156b8d3c74da4eda 100644 (file)
@@ -3,57 +3,42 @@ SOURCE[../../libcrypto]=\
         aes_misc.c aes_ecb.c aes_cfb.c aes_ofb.c \
         aes_ige.c aes_wrap.c {- $target{aes_asm_src} -}
 
+GENERATE[aes-ia64.s]=asm/aes-ia64.S
+
+GENERATE[aes-586.s]=asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[aes-586.s]=../perlasm/x86asm.pl
+GENERATE[vpaes-x86.s]=asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[vpaes-586.s]=../perlasm/x86asm.pl
+GENERATE[aesni-x86.s]=asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[aesni-586.s]=../perlasm/x86asm.pl
+
+GENERATE[aes-x86_64.s]=asm/aes-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[vpaes-x86_64.s]=asm/vpaes-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[bsaes-x86_64.s]=asm/bsaes-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[aesni-x86_64.s]=asm/aesni-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[aesni-sha1-x86_64.s]=asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[aesni-sha256-x86_64.s]=asm/aesni-sha256-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[aesni-mb-x86_64.s]=asm/aesni-mb-x86_64.pl $(PERLASM_SCHEME)
+
+GENERATE[aes-sparcv9.S]=asm/aes-sparcv9.pl $(PERLASM_SCHEME)
+GENERATE[aest4-sparcv9.S]=asm/aest4-sparcv9.pl $(PERLASM_SCHEME)
+DEPEND[aest4-sparcv9.S]=../perlasm/sparcv9_modes.pl
+
+GENERATE[aes-ppc.s]=asm/aes-ppc.pl $(PERLASM_SCHEME)
+GENERATE[vpaes-ppc.s]=asm/vpaes-ppc.pl $(PERLASM_SCHEME)
+GENERATE[aesp8-ppc.s]=asm/aesp8-ppc.pl $(PERLASM_SCHEME)
+
+GENERATE[aes-parisc.s]=asm/aes-parisc.pl $(PERLASM_SCHEME)
+
+GENERATE[aes-mips.S]=asm/aes-mips.pl $(PERLASM_SCHEME)
+
+GENERATE[aesv8-armx.S]=asm/aesv8-armx.pl $(PERLASM_SCHEME)
+GENERATE[vpaes-armv8.S]=asm/vpaes-armv8.pl $(PERLASM_SCHEME)
+
+
 BEGINRAW[Makefile]
 ##### AES assembler implementations
 
-{- $builddir -}/aes-ia64.s: {- $sourcedir -}/asm/aes-ia64.S
-       $(CC) $(CFLAGS) -E asm/aes-ia64.S > $@
-
-{- $builddir -}/aes-586.s:     {- $sourcedir -}/asm/aes-586.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-{- $builddir -}/vpaes-x86.s:   {- $sourcedir -}/asm/vpaes-x86.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/vpaes-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-{- $builddir -}/aesni-x86.s:   {- $sourcedir -}/asm/aesni-x86.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-
-{- $builddir -}/aes-x86_64.s: {- $sourcedir -}/asm/aes-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/vpaes-x86_64.s:        {- $sourcedir -}/asm/vpaes-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/vpaes-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/bsaes-x86_64.s:        {- $sourcedir -}/asm/bsaes-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/bsaes-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/aesni-x86_64.s: {- $sourcedir -}/asm/aesni-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/aesni-sha1-x86_64.s:   {- $sourcedir -}/asm/aesni-sha1-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-sha1-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/aesni-sha256-x86_64.s: {- $sourcedir -}/asm/aesni-sha256-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-sha256-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/aesni-mb-x86_64.s:     {- $sourcedir -}/asm/aesni-mb-x86_64.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesni-mb-x86_64.pl $(PERLASM_SCHEME) > $@
-
-{- $builddir -}/aes-sparcv9.S: {- $sourcedir -}/asm/aes-sparcv9.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-sparcv9.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/aest4-sparcv9.s: {- $sourcedir -}/asm/aest4-sparcv9.pl {- $sourcetop -}/crypto/perlasm/sparcv9_modes.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aest4-sparcv9.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/aes-ppc.s:     {- $sourcedir -}/asm/aes-ppc.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-ppc.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/vpaes-ppc.s:   {- $sourcedir -}/asm/vpaes-ppc.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/vpaes-ppc.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/aesp8-ppc.s:   {- $sourcedir -}/asm/aesp8-ppc.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesp8-ppc.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/aes-parisc.s:  {- $sourcedir -}/asm/aes-parisc.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-parisc.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/aes-mips.S:    {- $sourcedir -}/asm/aes-mips.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aes-mips.pl $(PERLASM_SCHEME) $@
-
-{- $builddir -}/aesv8-armx.S:  {- $sourcedir -}/asm/aesv8-armx.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/aesv8-armx.pl $(PERLASM_SCHEME) $@
-{- $builddir -}/vpaes-armv8.S: {- $sourcedir -}/asm/vpaes-armv8.pl
-       CC="$(CC)" $(PERL) {- $sourcedir -}/asm/vpaes-armv8.pl $(PERLASM_SCHEME) $@
-
 # GNU make "catch all"
 {- $builddir -}/aes-%.S:       {- $sourcedir -}/asm/aes-%.pl
        CC="$(CC)" $(PERL) $< $(PERLASM_SCHEME) $@