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