1#	$NetBSD: Makefile,v 1.15 2018/03/04 04:09:03 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
24.include <bsd.own.mk>
25.include <bsd.shlib.mk>
26
27# XXX There's a bit of work to do before we can enable warnings.
28WARNS=0
29CWARNFLAGS.clang+=	-Wno-empty-body -Wno-unused-value -Wno-parentheses
30
31# XXX Not yet.
32LINTFLAGS+=-D__int128='long long'
33
34CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC}
35CPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include
36CPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
37CPPFLAGS+= -I${OPENSSLSRC}/crypto/modes
38CPPFLAGS+= -I${OPENSSLSRC}/../include
39
40CRYPTODIST=	${NETBSDSRCDIR}/crypto
41
42.include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
43.PATH: ${OPENSSLSRC} ${OPENSSLSRC}/include/openssl
44.PATH: ${OPENSSLSRC}/../include/openssl ${OPENSSLSRC}/include/internal
45
46.include "srcs.inc"
47
48AFLAGS+=-DELF
49LIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt
50
51OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
52
53# XXX CFLAGS: While it would be nice to know which compiler flags
54# XXX the library was built with, we don't want pathname information
55# XXX for the host toolchain embedded in the image.
56${SRCS}: buildinf.h
57buildinf.h: Makefile
58	@echo "#ifndef MK1MF_BUILD" >buildinf.h
59	@echo "#define CFLAGS \"`${CC} -v 2>&1 | grep 'gcc version'`\"" >>buildinf.h
60	@echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h
61	@echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h
62	@echo "#endif" >>buildinf.h
63
64CLEANFILES+= buildinf.h
65
66# This list is built from the contents of the include/openssl
67# directory in the OpenSSL source distribution.
68INCS+=	aes.h asn1.h asn1_mac.h asn1t.h bio.h blowfish.h bn.h \
69	buffer.h cast.h cmac.h cms.h comp.h conf.h conf_api.h crypto.h des.h \
70	dh.h dsa.h dso.h e_os2.h ebcdic.h ec.h ecdh.h ecdsa.h engine.h \
71	err.h evp.h hmac.h lhash.h kdf.h md2.h md4.h md5.h modes.h \
72	obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h \
73	pem.h pem2.h pkcs12.h pkcs7.h rand.h rc2.h rc4.h ripemd.h \
74	rsa.h safestack.h sha.h srp.h stack.h symhacks.h ts.h txt_db.h \
75	ui.h x509.h x509_vfy.h x509v3.h camellia.h \
76	whrlpool.h seed.h ct.h
77#	des_old.h
78
79# IDEA - patented, but we install the header anyways
80INCS+=	idea.h
81
82# RC5 - patented, but we install the header anyways
83INCS+=	rc5.h
84
85# MDC2 - patented, but we install the header anyways
86INCS+=	mdc2.h
87
88.if (${USE_FIPS} != "no")
89# FIPS
90# This part is always included, because OpenSSL does not protect
91# The FIPS include files
92.PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand
93INCS+=	fips.h fips_rand.h
94.endif
95
96.if (${USE_FIPS} != "no")
97CPPFLAGS+=-DOPENSSL_FIPS
98.PATH: ${OPENSSLSRC}/fips/aes
99SRCS+=fips_aes_core.c fips_aes_selftest.c
100.PATH: ${OPENSSLSRC}/fips/des
101SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c
102# asm/fips-dx86-elf.s
103.PATH: ${OPENSSLSRC}/fips/dh
104SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c
105.PATH: ${OPENSSLSRC}/fips/dsa
106SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c
107#.PATH: ${OPENSSLSRC}/fips/rand
108SRCS+=fips_rand.c
109.PATH: ${OPENSSLSRC}/fips/rsa
110SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c
111SRCS+=fips_sha1dgst.c fips_sha1_selftest.c
112# asm/sx86-elf.s
113.PATH: ${OPENSSLSRC}/fips/sha1
114#.PATH: ${OPENSSLSRC}/fips
115SRCS+=fips.c fips_err_wrapper.c
116
117SRCS+=rc5_skey.c i_skey.c mdc2dgst.c
118.endif
119
120COPTS.eng_padlock.c = -Wno-stack-protector
121
122INCSDIR=/usr/include/openssl
123
124LDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map
125
126PKGCONFIG=libcrypto
127.include "${.CURDIR}/../../pkgconfig.mk"
128
129
130.include <bsd.lib.mk>
131
132