Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Sep 2023 20:56:39 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 14dc723496c1 - stable/14 - libcrypto: Refactor Makefile.asm so it can be run outside of buildenv
Message-ID:  <202309082056.388Kudnb007366@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=14dc723496c1b2244a2b2ce29f9fd754494f4eea

commit 14dc723496c1b2244a2b2ce29f9fd754494f4eea
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-08-29 21:39:36 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-09-08 20:55:44 +0000

    libcrypto: Refactor Makefile.asm so it can be run outside of buildenv
    
    Currently Makefile.asm relies on the current buildenv to set CFLAGS
    for i386.  The current approach also leaves various temporary *.s
    files around in the current directory.  To make this a bit better:
    
    - Instead of using CFLAGS from buildenv for i386, define the actual
      flags the perl scripts need: -DOPENSSL_IA32_SSE2 to enable SSE2.
    
    - Change i386 to have the perl scripts write to /dev/stdout to avoid
      creating temporaries.  Previously i386 was generating the temporary
      files in the OpenSSL contrib src.
    
    - Cleanup temporary *.s files in the all target after generating the
      real *.S files for architectures which need them.
    
    - Remove a duplicate rule for aes-armv4.S.
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D41589
    
    (cherry picked from commit c0fe6b9d7506d6ce6f9ec3688ee0cc5656a8707e)
---
 secure/lib/libcrypto/Makefile.asm | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/secure/lib/libcrypto/Makefile.asm b/secure/lib/libcrypto/Makefile.asm
index 0ee8c17369e9..d3243e5b20b8 100644
--- a/secure/lib/libcrypto/Makefile.asm
+++ b/secure/lib/libcrypto/Makefile.asm
@@ -45,8 +45,9 @@ SRCS+=	keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl
 ASM=	${SRCS:R:S/$/.S/} sha256-armv8.S
 
 all:	${ASM}
+	rm -f ${ASM:R:S/$/.s/}
 
-CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s
+CLEANFILES=	${ASM}
 .SUFFIXES:	.pl
 
 sha256-armv8.S:	sha512-armv8.pl
@@ -125,8 +126,9 @@ SHA_TMP=	${SHA_ASM:S/$/.s/}
 ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
 
 all:	${ASM}
+	rm -f ${SHA_TMP}
 
-CLEANFILES=	${ASM} ${SHA_ASM:S/$/.s/}
+CLEANFILES=	${ASM}
 .SUFFIXES:	.pl
 
 .pl.S:
@@ -179,17 +181,14 @@ SRCS+=	poly1305-armv4.pl
 # sha
 SRCS+=	keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
 
-ASM=	aes-armv4.S ${SRCS:R:S/$/.S/}
+ASM=	${SRCS:R:S/$/.S/}
 
 all:	${ASM}
+	rm -f ${ASM:R:S/$/.s/}	
 
-CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/}
+CLEANFILES=	${ASM}
 .SUFFIXES:	.pl
 
-aes-armv4.S:	aes-armv4.pl
-	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
-	env CC=cc perl ${.ALLSRC} linux32 ) > ${.TARGET}
-
 .pl.S:
 	env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
 	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
@@ -217,6 +216,7 @@ aes-armv4.S:	aes-armv4.pl
 	${LCRYPTO_SRC}/engines/asm
 
 #PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
+CFLAGS=	-DOPENSSL_IA32_SSE2
 
 # cpuid
 SRCS=	x86cpuid.pl
@@ -276,17 +276,15 @@ ASM=	${SRCS:R:S/$/.S/}
 
 all:	${ASM}
 
-CLEANFILES=	${ASM} ${SRCS:R:S/$/.s/}
+CLEANFILES=	${ASM}
 .SUFFIXES:	.pl
 
 .pl.S:
 	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
 	echo '#ifdef PIC' ;\
-	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ${.IMPSRC:R:S/$/.s/} ;\
-	cat ${.IMPSRC:R:S/$/.s/} ;\
+	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic /dev/stdout ;\
 	echo '#else' ;\
-	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\
-	cat ${.IMPSRC:R:S/$/.s/} ;\
+	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} /dev/stdout ;\
 	echo '#endif' ) > ${.TARGET}
 
 .elif defined(ASM_powerpc)
@@ -325,6 +323,7 @@ SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
 ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
 
 all:	${ASM}
+	rm -f ${ASM:R:S/$/.s/}
 
 CLEANFILES=	${ASM}
 .SUFFIXES:	.pl
@@ -392,6 +391,7 @@ SRCS+=	keccak1600-ppc64.pl
 ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
 
 all:	${ASM}
+	rm -f ${ASM:R:S/$/.s/}
 
 CLEANFILES=	${ASM}
 .SUFFIXES:	.pl
@@ -459,6 +459,7 @@ SRCS+=	keccak1600-ppc64.pl
 ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
 
 all:	${ASM}
+	rm -f ${ASM:R:S/$/.s/}
 
 CLEANFILES=	${ASM}
 .SUFFIXES:	.pl



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309082056.388Kudnb007366>