Unified - adapt the generation of rc4 assembler to use GENERATE

This gets rid of the BEGINRAW..ENDRAW sections in crypto/rc4/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>
diff --git a/crypto/rc4/Makefile.in b/crypto/rc4/Makefile.in
index fe2ef7d..00e39ec 100644
--- a/crypto/rc4/Makefile.in
+++ b/crypto/rc4/Makefile.in
@@ -39,15 +39,15 @@
 	@touch lib
 
 rc4-586.s:	asm/rc4-586.pl ../perlasm/x86asm.pl
-	$(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
+	$(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
 
 rc4-x86_64.s: asm/rc4-x86_64.pl
-	$(PERL) asm/rc4-x86_64.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/rc4-x86_64.pl $(PERLASM_SCHEME) $@
 rc4-md5-x86_64.s:	asm/rc4-md5-x86_64.pl
-	$(PERL) asm/rc4-md5-x86_64.pl $(PERLASM_SCHEME) > $@
+	$(PERL) asm/rc4-md5-x86_64.pl $(PERLASM_SCHEME) $@
 
 rc4-ia64.S: asm/rc4-ia64.pl
-	$(PERL) asm/rc4-ia64.pl $(CFLAGS) > $@
+	$(PERL) asm/rc4-ia64.pl $(CFLAGS) $@
 
 rc4-parisc.s:	asm/rc4-parisc.pl
 	$(PERL) asm/rc4-parisc.pl $(PERLASM_SCHEME) $@
diff --git a/crypto/rc4/asm/rc4-586.pl b/crypto/rc4/asm/rc4-586.pl
index d04e177..a517adb 100644
--- a/crypto/rc4/asm/rc4-586.pl
+++ b/crypto/rc4/asm/rc4-586.pl
@@ -63,6 +63,9 @@
 push(@INC,"${dir}","${dir}../../perlasm");
 require "x86asm.pl";
 
+$output=pop;
+open STDOUT,">$output";
+
 &asm_init($ARGV[0],"rc4-586.pl",$x86only = $ARGV[$#ARGV] eq "386");
 
 $xx="eax";
@@ -415,3 +418,4 @@
 
 &asm_finish();
 
+close STDOUT;
diff --git a/crypto/rc4/asm/rc4-ia64.pl b/crypto/rc4/asm/rc4-ia64.pl
index 49cd5b5..b83e53a 100644
--- a/crypto/rc4/asm/rc4-ia64.pl
+++ b/crypto/rc4/asm/rc4-ia64.pl
@@ -164,6 +164,9 @@
 #     random input data).
 #
 
+$output = pop;
+open STDOUT,">$output";
+
 $phases = 4;		# number of stages/phases in the pipelined-loop
 $unroll_count = 6;	# number of times we unrolled it
 $pComI = (1 << 0);
@@ -753,3 +756,5 @@
 ___
 
 print $code;
+
+close STDOUT;
diff --git a/crypto/rc4/build.info b/crypto/rc4/build.info
index 8d63bab..b682903 100644
--- a/crypto/rc4/build.info
+++ b/crypto/rc4/build.info
@@ -2,21 +2,17 @@
 SOURCE[../../libcrypto]=\
         {- $target{rc4_asm_src} -}
 
+GENERATE[rc4-586.s]=asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
+DEPEND[rc4-586.s]=../perlasm/x86asm.pl
+
+GENERATE[rc4-x86_64.s]=asm/rc4-x86_64.pl $(PERLASM_SCHEME)
+GENERATE[rc4-md5-x86_64.s]=asm/rc4-md5-x86_64.pl $(PERLASM_SCHEME)
+
+GENERATE[rc4-ia64.S]=asm/rc4-ia64.pl $(CFLAGS)
+
+GENERATE[rc4-parisc.s]=asm/rc4-parisc.pl $(PERLASM_SCHEME)
+
 BEGINRAW[Makefile]
-{- $builddir -}/rc4-586.s:	{- $sourcedir -}/asm/rc4-586.pl {- $sourcetop -}/crypto/perlasm/x86asm.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
-
-{- $builddir -}/rc4-x86_64.s: {- $sourcedir -}/asm/rc4-x86_64.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rc4-x86_64.pl $(PERLASM_SCHEME) > $@
-{- $builddir -}/rc4-md5-x86_64.s:	{- $sourcedir -}/asm/rc4-md5-x86_64.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rc4-md5-x86_64.pl $(PERLASM_SCHEME) > $@
-
-{- $builddir -}/rc4-ia64.S: {- $sourcedir -}/asm/rc4-ia64.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rc4-ia64.pl $(CFLAGS) > $@
-
-{- $builddir -}/rc4-parisc.s:	{- $sourcedir -}/asm/rc4-parisc.pl
-	CC="$(CC)" $(PERL) {- $sourcedir -}/asm/rc4-parisc.pl $(PERLASM_SCHEME) $@
-
 {- $builddir -}/rc4-ia64.s: rc4-ia64.S
 	@case `awk '/^#define RC4_INT/{print$$NF}' $(SRCDIR)/include/openssl/opensslconf.h` in \
 	int)	set -x; $(CC) $(CFLAGS) -DSZ=4 -E rc4-ia64.S > $@ ;; \