1#	$NetBSD: Makefile,v 1.21 2022/04/15 22:26:36 rillig Exp $
2
3# RCSid:
4#	Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp
5#
6#	@(#) Copyright (c) 1994 Simon J. Gerraty
7#
8#	This file is provided in the hope that it will
9#	be of use.  There is absolutely NO WARRANTY.
10#	Permission to copy, redistribute or otherwise
11#	use this file is hereby granted provided that
12#	the above copyright notice and this notice are
13#	left intact.
14#
15#	Please send copies of changes and bug-fixes to:
16#	sjg@quick.com.au
17#
18
19LIB=	crypto
20USE_FORT?= yes	# cryptographic software
21USE_SHLIBDIR=	yes
22USE_FIPS=	no
23#DBG=-g
24
25.include <bsd.own.mk>
26.include <bsd.shlib.mk>
27
28# XXX: There's a bit of work to do before we can enable warnings.
29WARNS=0
30CWARNFLAGS.clang+=	-Wno-empty-body -Wno-unused-value -Wno-parentheses -Wno-implicit-int-float-conversion
31# XXX: This warning seems to trigger incorrectly
32CWARNFLAGS.clang+=	-Wno-atomic-alignment
33
34# XXX Not yet.
35LINTFLAGS+=-D__int128='long long'
36
37LINTFLAGS+=	-X 161	# constant in conditional context
38LINTFLAGS+=	-X 129	# expression has null effect
39LINTFLAGS+=	-X 117	# bitwise '>>' on signed value possibly nonportable
40LINTFLAGS+=	-X 231	# argument '%s' unused in function '%s'
41LINTFLAGS+=	-X 220	# fallthrough on case statement
42LINTFLAGS+=	-X 118	# semantics of '%s' change in ANSI C; use explicit cast
43
44CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC}
45CPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include
46CPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
47CPPFLAGS+= -I${OPENSSLSRC}/crypto/modes
48CPPFLAGS+= -I${OPENSSLSRC}/../include
49
50CRYPTODIST=	${NETBSDSRCDIR}/crypto
51
52.include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
53.PATH: ${OPENSSLSRC} ${OPENSSLSRC}/include/openssl
54.PATH: ${OPENSSLSRC}/../include/openssl ${OPENSSLSRC}/include/internal
55
56.include "srcs.inc"
57
58AFLAGS+=-DELF
59LIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt
60
61OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
62
63# XXX CFLAGS: While it would be nice to know which compiler flags
64# XXX the library was built with, we don't want pathname information
65# XXX for the host toolchain embedded in the image.
66${SRCS}: buildinf.h
67buildinf.h: Makefile
68	@echo "#ifndef MK1MF_BUILD" >buildinf.h
69	@echo "#define compiler_flags \"`${CC} -v 2>&1 | grep 'gcc version'`\"" >>buildinf.h
70	@echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h
71	@echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h
72	@echo "#endif" >>buildinf.h
73
74CLEANFILES+= buildinf.h
75
76# This list is built from the contents of the include/openssl
77# directory in the OpenSSL source distribution.
78INCS+= \
79aes.h \
80asn1.h \
81asn1_mac.h \
82asn1err.h \
83asn1t.h \
84async.h \
85asyncerr.h \
86bio.h \
87bioerr.h \
88blowfish.h \
89bn.h \
90bnerr.h \
91buffer.h \
92buffererr.h \
93camellia.h \
94cast.h \
95cmac.h \
96cms.h \
97cmserr.h \
98comp.h \
99comperr.h \
100conf.h \
101conf_api.h \
102conferr.h \
103crypto.h \
104cryptoerr.h \
105ct.h \
106cterr.h \
107des.h \
108dh.h \
109dherr.h \
110dsa.h \
111dsaerr.h \
112dtls1.h \
113e_os2.h \
114ebcdic.h \
115ec.h \
116ecdh.h \
117ecdsa.h \
118ecerr.h \
119engine.h \
120engineerr.h \
121err.h \
122evp.h \
123evperr.h \
124hmac.h \
125kdf.h \
126kdferr.h \
127lhash.h \
128md2.h \
129md4.h \
130md5.h \
131modes.h \
132obj_mac.h \
133objects.h \
134objectserr.h \
135ocsp.h \
136ocsperr.h \
137opensslconf.h \
138opensslv.h \
139ossl_typ.h \
140pem.h \
141pem2.h \
142pemerr.h \
143pkcs12.h \
144pkcs12err.h \
145pkcs7.h \
146pkcs7err.h \
147rand.h \
148rand_drbg.h \
149randerr.h \
150rc2.h \
151rc4.h \
152ripemd.h \
153rsa.h \
154rsaerr.h \
155safestack.h \
156seed.h \
157sha.h \
158srp.h \
159srtp.h \
160ssl.h \
161ssl2.h \
162ssl3.h \
163sslerr.h \
164stack.h \
165store.h \
166storeerr.h \
167symhacks.h \
168tls1.h \
169ts.h \
170tserr.h \
171txt_db.h \
172ui.h \
173uierr.h \
174whrlpool.h \
175x509.h \
176x509_vfy.h \
177x509err.h \
178x509v3.h \
179x509v3err.h
180
181# IDEA - patented, but we install the header anyways
182INCS+=	idea.h
183
184# RC5 - patented, but we install the header anyways
185INCS+=	rc5.h
186
187# MDC2 - patented, but we install the header anyways
188INCS+=	mdc2.h
189
190.if (${USE_FIPS} != "no")
191# FIPS
192# This part is always included, because OpenSSL does not protect
193# The FIPS include files
194.PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand
195INCS+=	fips.h fips_rand.h
196.endif
197
198.if (${USE_FIPS} != "no")
199CPPFLAGS+=-DOPENSSL_FIPS
200.PATH: ${OPENSSLSRC}/fips/aes
201SRCS+=fips_aes_core.c fips_aes_selftest.c
202.PATH: ${OPENSSLSRC}/fips/des
203SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c
204# asm/fips-dx86-elf.s
205.PATH: ${OPENSSLSRC}/fips/dh
206SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c
207.PATH: ${OPENSSLSRC}/fips/dsa
208SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c
209#.PATH: ${OPENSSLSRC}/fips/rand
210SRCS+=fips_rand.c
211.PATH: ${OPENSSLSRC}/fips/rsa
212SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c
213SRCS+=fips_sha1dgst.c fips_sha1_selftest.c
214# asm/sx86-elf.s
215.PATH: ${OPENSSLSRC}/fips/sha1
216#.PATH: ${OPENSSLSRC}/fips
217SRCS+=fips.c fips_err_wrapper.c
218
219SRCS+=rc5_skey.c i_skey.c mdc2dgst.c
220.endif
221
222COPTS.eng_padlock.c = -Wno-stack-protector
223
224INCSDIR=/usr/include/openssl
225
226LDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map
227
228PKGCONFIG=libcrypto
229.include "${.CURDIR}/../../pkgconfig.mk"
230
231
232.include <bsd.lib.mk>
233
234