11.36Srin#	$NetBSD: Makefile,v 1.36 2023/10/07 12:15:53 rin Exp $
21.32Snia
31.32SniaUSE_FORT?=	yes	# cryptographic software
41.26Sjhigh
51.26Sjhigh.include <bsd.own.mk>
61.13Slukem
71.13SlukemUSE_SHLIBDIR=	yes
81.7Sthorpej
91.26Sjhigh.if (defined(MKARGON2) && ${MKARGON2} != "no")
101.26SjhighHAVE_ARGON2=1
111.26Sjhigh.endif
121.26Sjhigh
131.1ScgdLIB=	crypt
141.4Scgd
151.16SchristosSRCS=	crypt.c md5crypt.c bcrypt.c crypt-sha1.c util.c pw_gensalt.c
161.18SdrochnerSRCS+=	hmac_sha1.c
171.12Sitojun
181.34SchristosCPPFLAGS+= -include ${.CURDIR}/namespace.h
191.34Schristos
201.26Sjhigh.if defined(HAVE_ARGON2)
211.28SniaARGON2DIR=	${NETBSDSRCDIR}/external/apache2/argon2
221.28Snia.PATH: ${ARGON2DIR}/dist/phc-winner-argon2/src \
231.28Snia	${ARGON2DIR}/dist/phc-winner-argon2/src/blake2 \
241.28Snia	${ARGON2DIR}/dist/phc-winner-argon2/include
251.28SniaCPPFLAGS+=	-DHAVE_ARGON2 -DARGON2_NO_THREADS
261.28SniaCPPFLAGS+=	-I${ARGON2DIR}/dist/phc-winner-argon2/include
271.26SjhighSRCS+=		crypt-argon2.c
281.28Snia# libargon2 sources
291.28Snia.  for src in argon2.c core.c blake2b.c encoding.c ref.c
301.28SniaSRCS+=		${src}
311.29SniaCOPTS.${src}+=	-fvisibility=hidden
321.28Snia.  endfor
331.26Sjhigh.endif
341.26Sjhigh
351.23SmattWARNS?=	5
361.4Scgd
371.27SchristosMAN=	crypt.3 pw_gensalt.3
381.4ScgdMLINKS= crypt.3 encrypt.3 crypt.3 setkey.3
391.4Scgd
401.35Smrg# XXXGCC12 - init_perm() takes a larger array than IE3264[] is, but
411.35Smrg# it doesn't need more.
421.35SmrgCOPTS.crypt.c+=	${CC_WNO_STRINGOP_OVERFLOW}
431.15Ssjg
441.15Ssjg.if make(*.test)
451.15Ssjg.SUFFIXES: .test
461.15Ssjg.c.test:
471.15Ssjg	${CC} -o $@ -DUNIT_TEST -DMAIN ${LDSTATIC} ${.IMPSRC} ${LDADD}
481.15SsjgLDADD+= -L${.OBJDIR} -l${LIB} -L${.OBJDIR}/../../libc
491.15SsjgDPADD+= lib${LIB}.a
501.15SsjgLDSTATIC?= -static
511.15Ssjg.include <bsd.prog.mk>
521.15Ssjg.else
531.4Scgd.include <bsd.lib.mk>
541.15Ssjg.endif
55