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