1# $NetBSD: Makefile,v 1.23 2023/05/06 17:07:22 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 -Wno-implicit-int-float-conversion 31# XXX: This warning seems to trigger incorrectly 32CWARNFLAGS.clang+= -Wno-atomic-alignment 33 34LINTFLAGS+= -X 161 # constant in conditional context 35LINTFLAGS+= -X 129 # expression has null effect 36LINTFLAGS+= -X 117 # bitwise '>>' on signed value possibly nonportable 37LINTFLAGS+= -X 231 # argument '%s' unused in function '%s' 38LINTFLAGS+= -X 220 # fallthrough on case statement 39LINTFLAGS+= -X 118 # semantics of '%s' change in ANSI C; use explicit cast 40 41CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC} 42CPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include 43CPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp 44CPPFLAGS+= -I${OPENSSLSRC}/crypto/modes 45CPPFLAGS+= -I${OPENSSLSRC}/../include 46CPPFLAGS+= -I${OPENSSLSRC}/providers/common/include 47CPPFLAGS+= -I${OPENSSLSRC}/providers/implementations/include 48 49 50CRYPTODIST= ${NETBSDSRCDIR}/crypto 51OPENSSLINC= ${OPENSSLSRC}/include/openssl 52 53.include "${NETBSDSRCDIR}/crypto/Makefile.openssl" 54.PATH: ${OPENSSLSRC} ${OPENSSLINC} 55.PATH: ${OPENSSLSRC}/../include/openssl 56.PATH: ${OPENSSLSRC}/providers/implementations/digests 57.PATH: ${OPENSSLSRC}/providers/implementations/macs 58 59.include "srcs.inc" 60.include "${.CURDIR}/../libdefault/srcs.inc" 61CPPFLAGS+= -I${.CURDIR}/../libdefault 62.PATH: ${.CURDIR}/../libdefault 63.include "${.CURDIR}/../libcommon/srcs.inc" 64.PATH: ${.CURDIR}/../libcommon 65 66AFLAGS+=-DELF 67LIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt 68 69OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 70 71# XXX CFLAGS: While it would be nice to know which compiler flags 72# XXX the library was built with, we don't want pathname information 73# XXX for the host toolchain embedded in the image. 74${SRCS}: buildinf.h 75buildinf.h: Makefile 76 @echo "#ifndef MK1MF_BUILD" >buildinf.h 77 @echo "#define compiler_flags \"`${CC} -v 2>&1 | grep 'gcc version'`\"" >>buildinf.h 78 @echo "#define PLATFORM \"NetBSD-${MACHINE_ARCH}\"" >>buildinf.h 79 @echo "#define DATE \"NetBSD ${OS_VERSION}\"" >>buildinf.h 80 @echo "#endif" >>buildinf.h 81 82CLEANFILES+= buildinf.h 83 84# This list is built from the contents of the include/openssl 85# directory in the OpenSSL source distribution. 86INCS+= \ 87aes.h \ 88asn1.h \ 89asn1_mac.h \ 90asn1err.h \ 91asn1t.h \ 92async.h \ 93asyncerr.h \ 94bio.h \ 95bioerr.h \ 96blowfish.h \ 97bn.h \ 98bnerr.h \ 99buffer.h \ 100buffererr.h \ 101camellia.h \ 102cast.h \ 103cmac.h \ 104cmp.h \ 105cmp_util.h \ 106cmperr.h \ 107cms.h \ 108cmserr.h \ 109comp.h \ 110comperr.h \ 111conf.h \ 112conf_api.h \ 113conferr.h \ 114configuration.h \ 115conftypes.h \ 116core.h \ 117core_dispatch.h \ 118core_names.h \ 119core_object.h \ 120crmf.h \ 121crmferr.h \ 122crypto.h \ 123cryptoerr.h \ 124cryptoerr_legacy.h \ 125ct.h \ 126cterr.h \ 127decoder.h \ 128decodererr.h \ 129des.h \ 130dh.h \ 131dherr.h \ 132dsa.h \ 133dsaerr.h \ 134dtls1.h \ 135e_os2.h \ 136ebcdic.h \ 137ec.h \ 138ecdh.h \ 139ecdsa.h \ 140ecerr.h \ 141encoder.h \ 142encodererr.h \ 143engine.h \ 144engineerr.h \ 145err.h \ 146ess.h \ 147esserr.h \ 148evp.h \ 149evperr.h \ 150fips_names.h \ 151fipskey.h \ 152hmac.h \ 153http.h \ 154httperr.h \ 155kdf.h \ 156kdferr.h \ 157lhash.h \ 158macros.h \ 159md2.h \ 160md4.h \ 161md5.h \ 162modes.h \ 163obj_mac.h \ 164objects.h \ 165objectserr.h \ 166ocsp.h \ 167ocsperr.h \ 168opensslconf.h \ 169opensslv.h \ 170ossl_typ.h \ 171param_build.h \ 172params.h \ 173pem.h \ 174pem2.h \ 175pemerr.h \ 176pkcs12.h \ 177pkcs12err.h \ 178pkcs7.h \ 179pkcs7err.h \ 180prov_ssl.h \ 181proverr.h \ 182provider.h \ 183rand.h \ 184randerr.h \ 185rc2.h \ 186rc4.h \ 187ripemd.h \ 188rsa.h \ 189rsaerr.h \ 190safestack.h \ 191seed.h \ 192self_test.h \ 193sha.h \ 194srp.h \ 195srtp.h \ 196ssl.h \ 197ssl2.h \ 198ssl3.h \ 199sslerr.h \ 200sslerr_legacy.h \ 201stack.h \ 202store.h \ 203storeerr.h \ 204symhacks.h \ 205tls1.h \ 206trace.h \ 207ts.h \ 208tserr.h \ 209txt_db.h \ 210types.h \ 211ui.h \ 212uierr.h \ 213whrlpool.h \ 214x509.h \ 215x509_vfy.h \ 216x509err.h \ 217x509v3.h \ 218x509v3err.h 219 220# IDEA - patented, but we install the header anyways 221INCS+= idea.h 222 223# RC5 - patented, but we install the header anyways 224INCS+= rc5.h 225 226# MDC2 - patented, but we install the header anyways 227INCS+= mdc2.h 228 229.if (${USE_FIPS} != "no") 230# FIPS 231# This part is always included, because OpenSSL does not protect 232# The FIPS include files 233.PATH: ${OPENSSLSRC}/fips ${OPENSSLSRC}/fips/rand 234INCS+= fips.h fips_rand.h 235.endif 236 237.if (${USE_FIPS} != "no") 238CPPFLAGS+=-DOPENSSL_FIPS 239.PATH: ${OPENSSLSRC}/fips/aes 240SRCS+=fips_aes_core.c fips_aes_selftest.c 241.PATH: ${OPENSSLSRC}/fips/des 242SRCS+=fips_des_enc.c fips_des_selftest.c fips_set_key.c 243# asm/fips-dx86-elf.s 244.PATH: ${OPENSSLSRC}/fips/dh 245SRCS+=fips_dh_check.c fips_dh_gen.c fips_dh_key.c 246.PATH: ${OPENSSLSRC}/fips/dsa 247SRCS+=fips_dsa_ossl.c fips_dsa_gen.c fips_dsa_selftest.c 248#.PATH: ${OPENSSLSRC}/fips/rand 249SRCS+=fips_rand.c 250.PATH: ${OPENSSLSRC}/fips/rsa 251SRCS+=fips_rsa_eay.c fips_rsa_gen.c fips_rsa_selftest.c 252SRCS+=fips_sha1dgst.c fips_sha1_selftest.c 253# asm/sx86-elf.s 254.PATH: ${OPENSSLSRC}/fips/sha1 255#.PATH: ${OPENSSLSRC}/fips 256SRCS+=fips.c fips_err_wrapper.c 257 258SRCS+=rc5_skey.c i_skey.c mdc2dgst.c 259.endif 260 261COPTS.eng_padlock.c = -Wno-stack-protector 262 263INCSDIR=/usr/include/openssl 264 265LDFLAGS+=-Wl,--version-script=${.CURDIR}/crypto.map 266 267PKGCONFIG=libcrypto 268.include "${.CURDIR}/../../pkgconfig.mk" 269 270# too much of a pain to generate opensslv.h / configuration.h / fipskey.h 271GENH = \ 272asn1.h \ 273asn1t.h \ 274bio.h \ 275cmp.h \ 276cms.h \ 277conf.h \ 278crmf.h \ 279crypto.h \ 280ct.h \ 281err.h \ 282ess.h \ 283lhash.h \ 284ocsp.h \ 285pkcs12.h \ 286pkcs7.h \ 287safestack.h \ 288srp.h \ 289ssl.h \ 290ui.h \ 291x509.h \ 292x509_vfy.h \ 293x509v3.h 294 295.for i in ${GENH} 296$i: $i.in 297 ${_MKTARGET_CREATE} 298 ${.CURDIR}/../../gen ${.ALLSRC} > ${.TARGET} 299.endfor 300 301.include <bsd.lib.mk> 302 303