Unified - adapt the generation of cpuid, uplink and buildinf to use GENERATE

This gets rid of the BEGINRAW..ENDRAW sections in crypto/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>
This commit is contained in:
Richard Levitte 2016-03-07 15:00:45 +01:00
parent 184bc45f68
commit 0a4edb931b
5 changed files with 35 additions and 37 deletions

View file

@ -64,7 +64,7 @@ buildinf.h: ../Makefile
$(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" >buildinf.h $(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" >buildinf.h
x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl
$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) $@
applink.o: $(TOP)/ms/applink.c applink.o: $(TOP)/ms/applink.c
$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c
@ -73,18 +73,18 @@ uplink.o: $(TOP)/ms/uplink.c applink.o
$(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c
uplink-x86.s: $(TOP)/ms/uplink-x86.pl uplink-x86.s: $(TOP)/ms/uplink-x86.pl
$(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@ $(PERL) $(TOP)/ms/uplink-x86.pl $(PERLASM_SCHEME) $@
x86_64cpuid.s: x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@ x86_64cpuid.s: x86_64cpuid.pl; $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) $@
ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@ ia64cpuid.s: ia64cpuid.S; $(CC) $(CFLAGS) -E ia64cpuid.S > $@
ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@ ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@
pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@ pariscid.s: pariscid.pl; $(PERL) pariscid.pl $(PERLASM_SCHEME) $@
alphacpuid.s: alphacpuid.pl alphacpuid.s: alphacpuid.pl
(preproc=$$$$.$@.S; trap "rm $$preproc" INT; \ (preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
$(PERL) alphacpuid.pl > $$preproc && \ $(PERL) alphacpuid.pl $$preproc && \
$(CC) -E -P $$preproc > $@ && rm $$preproc) $(CC) -E -P $$preproc > $@ && rm $$preproc)
arm64cpuid.S: arm64cpuid.pl; $(PERL) arm64cpuid.pl $(PERLASM_SCHEME) > $@ arm64cpuid.S: arm64cpuid.pl; $(PERL) arm64cpuid.pl $(PERLASM_SCHEME) $@
armv4cpuid.S: armv4cpuid.pl; $(PERL) armv4cpuid.pl $(PERLASM_SCHEME) > $@ armv4cpuid.S: armv4cpuid.pl; $(PERL) armv4cpuid.pl $(PERLASM_SCHEME) $@
subdirs: subdirs:
@target=all; $(RECURSIVE_MAKE) @target=all; $(RECURSIVE_MAKE)

View file

@ -1,4 +1,8 @@
#!/usr/bin/env perl #!/usr/bin/env perl
$output = pop;
open STDOUT,">$stdout";
print <<'___'; print <<'___';
.text .text
@ -214,3 +218,5 @@ OPENSSL_instrument_bus2:
.end OPENSSL_instrument_bus2 .end OPENSSL_instrument_bus2
___ ___
} }
close STDOUT;

View file

@ -11,38 +11,19 @@ EXTRA= ../ms/uplink-x86.pl ../ms/uplink.c ../ms/applink.c \
ppccpuid.pl pariscid.pl alphacpuid.pl arm64cpuid.pl armv4cpuid.pl ppccpuid.pl pariscid.pl alphacpuid.pl arm64cpuid.pl armv4cpuid.pl
DEPEND[cversion.o]=buildinf.h DEPEND[cversion.o]=buildinf.h
GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)"
DEPEND[buildinf.h]=configdata.pm
BEGINRAW[descrip.mms] GENERATE[uplink-x86.s]=../ms/uplink-x86.pl $(PERLASM_SCHEME)
[.crypto]buildinf.h : configdata.pm
$(PERL) {- catfile(catdir($sourcedir, "[-]"), "util", "mkbuildinf.pl") -} "$(CC) $(CFLAGS)" "$(PLATFORM)" > [.crypto]buildinf.h
ENDRAW[descrip.mms]
BEGINRAW[Makefile] GENERATE[x86cpuid.s]=x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR)
crypto/buildinf.h : configdata.pm DEPEND[x86cpuid.s]=perlasm/x86asm.pl
$(PERL) $(SRCDIR)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" > crypto/buildinf.h
##### APPLINK, UPLINK and CPUID assembler implementations GENERATE[x86_64cpuid.s]=x86_64cpuid.pl $(PERLASM_SCHEME)
{- $builddir -}/uplink-x86.s: $(SRCDIR)/ms/uplink-x86.pl GENERATE[ia64cpuid.s]=ia64cpuid.S
CC="$(CC)" $(PERL) $(SRCDIR)/ms/uplink-x86.pl $(PERLASM_SCHEME) > $@ GENERATE[ppccpuid.s]=ppccpuid.pl $(PERLASM_SCHEM
GENERATE[pariscid.s]=pariscid.pl $(PERLASM_SCHEM
{- $builddir -}/x86cpuid.s: {- $sourcedir -}/x86cpuid.pl {- $sourcedir -}/perlasm/x86asm.pl GENERATE[alphacpuid.s]=alphacpuid.pl
CC="$(CC)" $(PERL) {- $sourcedir -}/x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ GENERATE[arm64cpuid.S]=arm64cpuid.pl $(PERLASM_SCHEME)
GENERATE[armv4cpuid.S]=armv4cpuid.pl $(PERLASM_SCHEME)
{- $builddir -}/x86_64cpuid.s: {- $sourcedir -}/x86_64cpuid.pl
CC="$(CC)" $(PERL) {- $sourcedir -}/x86_64cpuid.pl $(PERLASM_SCHEME) > $@
{- $builddir -}/ia64cpuid.s: {- $sourcedir -}/ia64cpuid.S
$(CC) $(CFLAGS) -E {- $sourcedir -}/ia64cpuid.S > $@
{- $builddir -}/ppccpuid.s: {- $sourcedir -}/ppccpuid.pl
CC="$(CC)" $(PERL) {- $sourcedir -}/ppccpuid.pl $(PERLASM_SCHEME) $@
{- $builddir -}/pariscid.s: {- $sourcedir -}/pariscid.pl
CC="$(CC)" $(PERL) {- $sourcedir -}/pariscid.pl $(PERLASM_SCHEME) $@
{- $builddir -}/alphacpuid.s: {- $sourcedir -}/alphacpuid.pl
(preproc=$$$$.$@.S; trap "rm $$preproc" INT; \
CC="$(CC)" $(PERL) {- $sourcedir -}/alphacpuid.pl > $$preproc && \
$(CC) -E -P $$preproc > $@ && rm $$preproc)
{- $builddir -}/arm64cpuid.S: {- $sourcedir -}/arm64cpuid.pl
CC="$(CC)" $(PERL) {- $sourcedir -}/arm64cpuid.pl $(PERLASM_SCHEME) > $@
{- $builddir -}/armv4cpuid.S: {- $sourcedir -}/armv4cpuid.pl
CC="$(CC)" $(PERL) {- $sourcedir -}/armv4cpuid.pl $(PERLASM_SCHEME) > $@
ENDRAW[Makefile]

View file

@ -4,6 +4,10 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
push(@INC, "${dir}perlasm", "perlasm"); push(@INC, "${dir}perlasm", "perlasm");
require "x86asm.pl"; require "x86asm.pl";
$output = pop;
open OUT,">$output";
*STDOUT=*OUT;
&asm_init($ARGV[0],"x86cpuid"); &asm_init($ARGV[0],"x86cpuid");
for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
@ -487,3 +491,5 @@ my $max = "ebp";
&hidden("OPENSSL_ia32cap_P"); &hidden("OPENSSL_ia32cap_P");
&asm_finish(); &asm_finish();
close STDOUT;

View file

@ -6,6 +6,9 @@ require "x86asm.pl";
require "uplink-common.pl"; require "uplink-common.pl";
$output = pop;
open STDOUT,">$output";
&asm_init($ARGV[0],"uplink-x86"); &asm_init($ARGV[0],"uplink-x86");
&external_label("OPENSSL_Uplink"); &external_label("OPENSSL_Uplink");
@ -31,3 +34,5 @@ for ($i=1;$i<=$N;$i++) {
&data_word(&label("_\$lazy${i}")); &data_word(&label("_\$lazy${i}"));
} }
&asm_finish(); &asm_finish();
close OUTPUT;