Makefile revision 1.8
11.8Sriastrad#	$NetBSD: Makefile,v 1.8 2025/11/22 22:32:39 riastradh Exp $
21.1Sriastrad
31.1Sriastrad.include <bsd.own.mk>
41.1Sriastrad
51.1SriastradTESTSDIR=	${TESTSBASE}/sys/crypto/aes
61.1Sriastrad
71.1SriastradTESTS_C=	t_aes
81.1Sriastrad
91.3SriastradAFLAGS+=	-D_LOCORE
101.3Sriastrad
111.1Sriastrad.PATH:	${NETBSDSRCDIR}/sys/crypto/aes
121.1SriastradCPPFLAGS+=	-I${NETBSDSRCDIR}/sys
131.1Sriastrad
141.1SriastradSRCS.t_aes+=	t_aes.c
151.1Sriastrad
161.1SriastradSRCS.t_aes+=	aes_bear.c
171.1SriastradSRCS.t_aes+=	aes_ct.c
181.1SriastradSRCS.t_aes+=	aes_ct_dec.c
191.1SriastradSRCS.t_aes+=	aes_ct_enc.c
201.8SriastradSRCS.t_aes+=	aes_keysched.c
211.1SriastradSRCS.t_aes+=	aes_selftest.c
221.1Sriastrad
231.5Sriastrad.if !empty(MACHINE_ARCH:Mearmv7*) || !empty(MACHINE_ARCH:Maarch64*)
241.1Sriastrad
251.1Sriastrad.PATH:	${NETBSDSRCDIR}/sys/crypto/aes/arch/arm
261.1SriastradCPPFLAGS+=	-I${NETBSDSRCDIR}/sys/crypto/aes/arch/arm
271.1Sriastrad
281.1Sriastrad.if !empty(MACHINE_ARCH:Maarch64*)	# XXX no AESE/AESD in 32-bit mode yet
291.1SriastradSRCS.t_aes+=	aes_armv8.c
301.1SriastradSRCS.t_aes+=	aes_armv8_64.S
311.1Sriastrad.endif
321.1Sriastrad
331.6SjakllschCLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION= ${${ACTIVE_CC} == "clang":? -Wno-nonportable-vector-initialization :}
341.6Sjakllsch
351.1SriastradSRCS.t_aes+=	aes_neon.c
361.6SjakllschCOPTS.aes_neon.c+=${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
371.1SriastradSRCS.t_aes+=	aes_neon_impl.c
381.1SriastradSRCS.t_aes+=	aes_neon_subr.c
391.6SjakllschCOPTS.aes_neon_subr.c+=${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
401.5Sriastrad.if !empty(MACHINE_ARCH:Mearmv7*)
411.1SriastradSRCS.t_aes+=	aes_neon_32.S
421.1Sriastrad.endif
431.1Sriastrad
441.5Sriastrad.if !empty(MACHINE_ARCH:Mearmv7*) && empty(MACHINE_ARCH:Mearmv7hf*)
451.5SriastradCOPTS.aes_neon.c+=	-mfloat-abi=softfp -mfpu=neon
461.5SriastradCOPTS.aes_neon_subr.c+=	-mfloat-abi=softfp -mfpu=neon
471.5SriastradAOPTS.aes_neon_32.S+=	-D__SOFTFP__
481.5Sriastrad.endif
491.5Sriastrad
501.1Sriastrad.endif				# earmv7/aarch64
511.1Sriastrad
521.1Sriastrad.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
531.1Sriastrad
541.1Sriastrad.PATH:	${NETBSDSRCDIR}/sys/crypto/aes/arch/x86
551.1SriastradCPPFLAGS+=	-I${NETBSDSRCDIR}/sys/crypto/aes/arch/x86
561.1Sriastrad
571.1Sriastrad.if ${MACHINE_ARCH} == "x86_64"		# XXX no AES-NI in 32-bit mode yet
581.1SriastradSRCS.t_aes+=	aes_ni.c
591.1SriastradSRCS.t_aes+=	aes_ni_64.S
601.1Sriastrad.endif
611.1Sriastrad
621.1SriastradSRCS.t_aes+=	aes_sse2.c
631.1SriastradSRCS.t_aes+=	aes_sse2_dec.c
641.1SriastradSRCS.t_aes+=	aes_sse2_enc.c
651.1SriastradSRCS.t_aes+=	aes_sse2_impl.c
661.1SriastradSRCS.t_aes+=	aes_sse2_subr.c
671.2SriastradCOPTS.aes_sse2.c+=	-msse -msse2
681.2SriastradCOPTS.aes_sse2_dec.c+=	-msse -msse2
691.2SriastradCOPTS.aes_sse2_enc.c+=	-msse -msse2
701.2SriastradCOPTS.aes_sse2_subr.c+=	-msse -msse2
711.1Sriastrad
721.1SriastradSRCS.t_aes+=	aes_ssse3.c
731.1SriastradSRCS.t_aes+=	aes_ssse3_impl.c
741.1SriastradSRCS.t_aes+=	aes_ssse3_subr.c
751.2SriastradCOPTS.aes_ssse3.c+=		-msse -msse2 -msse3 -mssse3
761.2SriastradCOPTS.aes_ssse3_subr.c+=	-msse -msse2 -msse3 -mssse3
771.1Sriastrad
781.1SriastradSRCS.t_aes+=	aes_via.c
791.1Sriastrad
801.1Sriastrad.endif				# x86
811.1Sriastrad
821.1SriastradWARNS=		5
831.1Sriastrad
841.7Smrg# Many of these are probably GCC bugs, see
851.7Smrg#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110878
861.7SmrgCOPTS.aes_armv8.c+=	${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW}
871.7SmrgCOPTS.aes_bear.c+=	${CC_WNO_STRINGOP_OVERFLOW} ${CC_WNO_ARRAY_BOUNDS}
881.7SmrgCOPTS.aes_neon_subr.c+=	${CC_WNO_ARRAY_BOUNDS}
891.7Smrg
901.7SmrgCOPTS.aes_ni.c+=	${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW}
911.7SmrgCOPTS.aes_sse2_subr.c+=	${CC_WNO_ARRAY_BOUNDS}
921.7SmrgCOPTS.aes_ssse3_subr.c+=${CC_WNO_ARRAY_BOUNDS}
931.7SmrgCOPTS.aes_via.c+=	${CC_WNO_ARRAY_BOUNDS}
941.7Smrg
951.1Sriastrad.include <bsd.test.mk>
96