xref: /freebsd/secure/lib/libcrypto/Makefile.inc (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1# $FreeBSD$
2
3.include <bsd.own.mk>
4
5# OpenSSL version used for manual page generation
6OPENSSL_VER=	1.0.2h
7OPENSSL_DATE=	2016-05-03
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"
25CFLAGS+=-DOPENSSL_IA32_SSE2
26CFLAGS+=-DAES_ASM -DBSAES_ASM -DVPAES_ASM
27CFLAGS+=-DECP_NISTZ256_ASM
28CFLAGS+=-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m
29CFLAGS+=-DMD5_ASM
30CFLAGS+=-DGHASH_ASM
31CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
32CFLAGS+=-DWHIRLPOOL_ASM
33.elif ${MACHINE_CPUARCH} == "i386"
34CFLAGS+=-DOPENSSL_IA32_SSE2
35CFLAGS+=-DAES_ASM -DVPAES_ASM
36CFLAGS+=-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
37CFLAGS+=-DMD5_ASM
38CFLAGS+=-DGHASH_ASM
39CFLAGS+=-DRMD160_ASM
40CFLAGS+=-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
41CFLAGS+=-DWHIRLPOOL_ASM
42.endif
43
44MANDIR=	${SHAREDIR}/openssl/man/man
45
46.if defined(LIB)
47_docs=	${LIB}
48_skip=	SSLeay_version des_modes
49_sec=	3
50.else
51_docs=	apps
52_skip=	config
53_sec=	1
54.endif
55
56man-update:
57.for manpage in ${MAN}
58	@(sec=${manpage:E}; \
59	pod=${manpage:R}.pod; \
60	cp ${LCRYPTO_DOC}/${_docs}/$$pod .; \
61	pod2man --section=$$sec --release="${OPENSSL_VER}" \
62	  --date="${OPENSSL_DATE}" --center="OpenSSL"  \
63	  $$pod > ${.CURDIR}/man/${manpage}; \
64	rm -f $$pod; \
65	${ECHO} ${manpage})
66.endfor
67
68man-makefile-update:
69	rm -f ${.CURDIR}/Makefile.man
70	echo '# $$'FreeBSD'$$' >> ${.CURDIR}/Makefile.man
71	echo '# DO NOT EDIT: generated from man-makefile-update target' >> \
72	    ${.CURDIR}/Makefile.man
73	for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
74		fn=`basename $$i .pod`; \
75		if ! echo '${_skip}' | grep -qw "$$fn"; then \
76		${ECHO} "MAN+= $$fn.${_sec}" >> ${.CURDIR}/Makefile.man; \
77		fi; \
78	done
79	for i in ${LCRYPTO_DOC}/${_docs}/*.pod; do \
80		fn=`basename $$i .pod`; \
81		if ! echo '${_skip}' | grep -qw "$$fn"; then \
82		perl ${LCRYPTO_SRC}/util/extract-names.pl < $$i | \
83		  awk "/^$$fn\$$/ { next; } \
84		  { print \"MLINKS+= $$fn.${_sec} \" \$$1 \".${_sec}\" }" >> \
85		  ${.CURDIR}/Makefile.man; \
86		fi; \
87	done
88