1#	$NetBSD: Makefile,v 1.16 2018/04/06 23:04:46 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 CFLAGS \"`${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+=	aes.h asn1.h asn1_mac.h asn1t.h bio.h blowfish.h bn.h \
70	buffer.h cast.h cmac.h cms.h comp.h conf.h conf_api.h crypto.h des.h \
71	dh.h dsa.h dso.h e_os2.h ebcdic.h ec.h ecdh.h ecdsa.h engine.h \
72	err.h evp.h hmac.h lhash.h kdf.h md2.h md4.h md5.h modes.h \
73	obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h \
74	pem.h pem2.h pkcs12.h pkcs7.h rand.h rc2.h rc4.h ripemd.h \
75	rsa.h safestack.h sha.h srp.h stack.h symhacks.h ts.h txt_db.h \
76	ui.h x509.h x509_vfy.h x509v3.h camellia.h \
77	whrlpool.h seed.h ct.h
78#	des_old.h
79
80# IDEA - patented, but we install the header anyways
81INCS+=	idea.h
82
83# RC5 - patented, but we install the header anyways
84INCS+=	rc5.h
85
86# MDC2 - patented, but we install the header anyways
87INCS+=	mdc2.h
88
89.if (${USE_FIPS} != "no")
90# FIPS
91# This part is always included, because OpenSSL does not protect
92# The FIPS include files
93.PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand
94INCS+=	fips.h fips_rand.h
95.endif
96
97.if (${USE_FIPS} != "no")
98CPPFLAGS+=-DOPENSSL_FIPS
99.PATH: ${OPENSSLSRC}/fips/aes
100SRCS+=fips_aes_core.c fips_aes_selftest.c
101.PATH: ${OPENSSLSRC}/fips/des
102SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c
103# asm/fips-dx86-elf.s
104.PATH: ${OPENSSLSRC}/fips/dh
105SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c
106.PATH: ${OPENSSLSRC}/fips/dsa
107SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c
108#.PATH: ${OPENSSLSRC}/fips/rand
109SRCS+=fips_rand.c
110.PATH: ${OPENSSLSRC}/fips/rsa
111SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c
112SRCS+=fips_sha1dgst.c fips_sha1_selftest.c
113# asm/sx86-elf.s
114.PATH: ${OPENSSLSRC}/fips/sha1
115#.PATH: ${OPENSSLSRC}/fips
116SRCS+=fips.c fips_err_wrapper.c
117
118SRCS+=rc5_skey.c i_skey.c mdc2dgst.c
119.endif
120
121COPTS.eng_padlock.c = -Wno-stack-protector
122
123INCSDIR=/usr/include/openssl
124
125LDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map
126
127PKGCONFIG=libcrypto
128.include "${.CURDIR}/../../pkgconfig.mk"
129
130
131.include <bsd.lib.mk>
132
133