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