Makefile.inc revision 325335
1# $FreeBSD: stable/11/secure/lib/libcrypto/Makefile.inc 325335 2017-11-02 18:22:53Z jkim $
2
3.include <bsd.own.mk>
4
5# OpenSSL version used for manual page generation
6OPENSSL_VER=	1.0.2l
7OPENSSL_DATE=	2017-05-25
8
9LCRYPTO_SRC=	${SRCTOP}/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} == "aarch64" || ${MACHINE_CPUARCH} == "arm"
25ASM_${MACHINE_CPUARCH}=
26.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
27_ASM_AVX!=	{ \
28		    echo vzeroall | \
29		    ${CC} -x assembler -o /dev/null -c - 2> /dev/null; \
30		} && echo yes || echo no
31.if ${_ASM_AVX} == yes
32ASM_${MACHINE_CPUARCH}=
33.endif
34.endif
35
36.if defined(ASM_aarch64)
37CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
38.elif defined(ASM_amd64)
39CFLAGS+=-DOPENSSL_IA32_SSE2
40CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM
41CFLAGS+=-DECP_NISTZ256_ASM
42CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m
43CFLAGS+=-DMD5_ASM
44CFLAGS+=-DGHASH_ASM
45CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
46CFLAGS+=-DWHIRLPOOL_ASM
47.elif defined(ASM_arm)
48CFLAGS+=-DAES_ASM -DBSAES_ASM
49CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
50CFLAGS+=-DGHASH_ASM
51CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
52.elif defined(ASM_i386)
53CFLAGS+=-DOPENSSL_IA32_SSE2
54CFLAGS+=-DAES_ASM -DVPAES_ASM
55CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
56CFLAGS+=-DMD5_ASM
57CFLAGS+=-DGHASH_ASM
58CFLAGS+=-DRMD160_ASM
59CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
60CFLAGS+=-DWHIRLPOOL_ASM
61.endif
62
63MANDIR=	${SHAREDIR}/openssl/man/man
64
65.if defined(LIB)
66_docs=	${LIB}
67.if ${LIB} == ssl
68_docs+=	man3
69.endif
70_skip=	SSLeay_version des_modes
71_sec=	3
72.else
73_docs=	apps
74_skip=	config
75_sec=	1
76.endif
77
78man-update:
79.for manpage in ${MAN}
80	@(sec=${manpage:E}; \
81	pod=${manpage:R}.pod; \
82	for i in ${_docs}; do \
83		test -f ${LCRYPTO_DOC}/$$i/$$pod && \
84		cp ${LCRYPTO_DOC}/$$i/$$pod .; \
85	done; \
86	pod2man --section=$$sec --release="${OPENSSL_VER}" \
87	  --date="${OPENSSL_DATE}" --center="OpenSSL"  \
88	  $$pod > ${.CURDIR}/man/${manpage}; \
89	rm -f $$pod; \
90	${ECHO} ${manpage})
91.endfor
92
93man-makefile-update:
94	rm -f ${.CURDIR}/Makefile.man
95	echo '# $$'FreeBSD'$$' >> ${.CURDIR}/Makefile.man
96	echo '# DO NOT EDIT: generated from man-makefile-update target' >> \
97	    ${.CURDIR}/Makefile.man
98	for i in ${_docs}; do \
99		for j in ${LCRYPTO_DOC}/$$i/*.pod; do \
100			test -f $$j || continue; \
101			fn=`basename $$j .pod`; \
102			if ! echo '${_skip}' | grep -qw "$$fn"; then \
103			${ECHO} "MAN+= $$fn.${_sec}"; \
104			fi; \
105		done; \
106	done | env LANG=C sort >> ${.CURDIR}/Makefile.man
107	for i in ${_docs}; do \
108		for j in ${LCRYPTO_DOC}/$$i/*.pod; do \
109			test -f $$j || continue; \
110			fn=`basename $$j .pod`; \
111			if ! echo '${_skip}' | grep -qw "$$fn"; then \
112			perl ${LCRYPTO_SRC}/util/extract-names.pl < $$j | \
113			  awk "/^$$fn\$$/ { next; } \
114			  { print \"MLINKS+= $$fn.${_sec} \" \$$1 \".${_sec}\" }"; \
115			fi; \
116		done; \
117	done | env LANG=C sort >> ${.CURDIR}/Makefile.man
118