xref: /freebsd/secure/lib/libcrypto/Makefile.inc (revision 273c26a3c3bea87a241d6879abd4f991db180bf0)
1# $FreeBSD$
2
3.include <bsd.own.mk>
4
5# OpenSSL version used for manual page generation
6OPENSSL_VER=	1.0.2j
7OPENSSL_DATE=	2016-09-26
8
9LCRYPTO_SRC=	${.CURDIR}/../../../crypto/openssl
10LCRYPTO_DOC=	${LCRYPTO_SRC}/doc
11
12CFLAGS+=	-I${LCRYPTO_SRC}
13CFLAGS+=	-DTERMIOS -DANSI_SOURCE
14CFLAGS+=	-DOPENSSL_THREADS -DDSO_DLFCN -DHAVE_DLFCN_H
15
16.include <bsd.endian.mk>
17
18.if ${TARGET_ENDIANNESS} == 1234
19CFLAGS+=-DL_ENDIAN
20.elif ${TARGET_ENDIANNESS} == 4321
21CFLAGS+=-DB_ENDIAN
22.endif
23
24.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
25_ASM_AVX!=	{ \
26		    echo vzeroall | \
27		    ${CC} -x assembler -o /dev/null -c - 2> /dev/null; \
28		} && echo yes || echo no
29.if ${_ASM_AVX} == yes
30ASM_${MACHINE_CPUARCH}=
31.endif
32.elif ${MACHINE_CPUARCH} == "arm"
33ASM_arm=
34.endif
35
36.if defined(ASM_amd64)
37CFLAGS+=-DOPENSSL_IA32_SSE2
38CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM
39CFLAGS+=-DECP_NISTZ256_ASM
40CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m
41CFLAGS+=-DMD5_ASM
42CFLAGS+=-DGHASH_ASM
43CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
44CFLAGS+=-DWHIRLPOOL_ASM
45.elif defined(ASM_arm)
46CFLAGS+=-DAES_ASM -DBSAES_ASM
47CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
48CFLAGS+=-DGHASH_ASM
49CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
50.elif defined(ASM_i386)
51CFLAGS+=-DOPENSSL_IA32_SSE2
52CFLAGS+=-DAES_ASM -DVPAES_ASM
53CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
54CFLAGS+=-DMD5_ASM
55CFLAGS+=-DGHASH_ASM
56CFLAGS+=-DRMD160_ASM
57CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
58CFLAGS+=-DWHIRLPOOL_ASM
59.endif
60
61MANDIR=	${SHAREDIR}/openssl/man/man
62
63.if defined(LIB)
64_docs=	${LIB}
65_skip=	SSLeay_version des_modes
66_sec=	3
67.else
68_docs=	apps
69_skip=	config
70_sec=	1
71.endif
72
73man-update:
74.for manpage in ${MAN}
75	@(sec=${manpage:E}; \
76	pod=${manpage:R}.pod; \
77	cp ${LCRYPTO_DOC}/${_docs}/$$pod .; \
78	pod2man --section=$$sec --release="${OPENSSL_VER}" \
79	  --date="${OPENSSL_DATE}" --center="OpenSSL"  \
80	  $$pod > ${.CURDIR}/man/${manpage}; \
81	rm -f $$pod; \
82	${ECHO} ${manpage})
83.endfor
84
85man-makefile-update:
86	rm -f ${.CURDIR}/Makefile.man
87	echo '# $$'FreeBSD'$$' >> ${.CURDIR}/Makefile.man
88	echo '# DO NOT EDIT: generated from man-makefile-update target' >> \
89	    ${.CURDIR}/Makefile.man
90	for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
91		fn=`basename $$i .pod`; \
92		if ! echo '${_skip}' | grep -qw "$$fn"; then \
93		${ECHO} "MAN+= $$fn.${_sec}" >> ${.CURDIR}/Makefile.man; \
94		fi; \
95	done
96	for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
97		fn=`basename $$i .pod`; \
98		if ! echo '${_skip}' | grep -qw "$$fn"; then \
99		perl ${LCRYPTO_SRC}/util/extract-names.pl < $$i | \
100		  awk "/^$$fn\$$/ { next; } \
101		  { print \"MLINKS+= $$fn.${_sec} \" \$$1 \".${_sec}\" }" >> \
102		  ${.CURDIR}/Makefile.man; \
103		fi; \
104	done
105