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