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