1 # $NetBSD: Makefile,v 1.48 2026/04/08 18:58:42 christos Exp $ 2 3 # libssh is not meant for applications to link against -- it's a 4 # private library of the ssh/sshd/&c. executables we ship. So don't 5 # install compat versions (we don't ship ssh/sshd/&c. as compat 6 # executables, only as native ones) or expose the .so symlink or .a 7 # static library for applications to link against. 8 # 9 # Note that while NOLINKLIB suppresses _installing_ the .so symlink, 10 # the .so symlink is still created in the objdir so bin/ssh can still 11 # use it to link. 12 NOLINKLIB= # defined 13 14 .include <bsd.own.mk> 15 16 .include "../Makefile.inc" 17 18 CWARNFLAGS.clang+= -Wno-error=sizeof-array-div 19 CWARNFLAGS.clang+= -Wno-error=format-nonliteral 20 LIB= ssh 21 SRCS=\ 22 addr.c \ 23 addrmatch.c \ 24 atomicio.c \ 25 authfd.c \ 26 authfile.c \ 27 bcrypt_pbkdf.c \ 28 bitmap.c \ 29 blowfish.c \ 30 canohost.c \ 31 chacha.c \ 32 channels.c \ 33 cipher-chachapoly.c \ 34 cipher.c \ 35 cleanup.c \ 36 compat.c \ 37 dispatch.c \ 38 dns.c \ 39 ed25519.c \ 40 fatal.c \ 41 freezero.c \ 42 hmac.c \ 43 hostfile.c \ 44 kex.c \ 45 kexc25519.c \ 46 kex-names.c \ 47 kexgen.c \ 48 kexmlkem768x25519.c \ 49 kexsntrup761x25519.c \ 50 krl.c \ 51 log.c \ 52 mac.c \ 53 match.c \ 54 misc.c \ 55 monitor_fdpass.c \ 56 msg.c \ 57 nchan.c \ 58 packet.c \ 59 poly1305.c \ 60 progressmeter.c \ 61 readpass.c \ 62 recallocarray.c \ 63 smult_curve25519_ref.c \ 64 sntrup761.c \ 65 ssh-ed25519.c \ 66 ssh-ed25519-sk.c \ 67 ssh-pkcs11.c \ 68 ssh-sk-client.c \ 69 sshbuf-getput-basic.c \ 70 sshbuf-misc.c \ 71 sshbuf-io.c \ 72 sshbuf.c \ 73 ssherr.c \ 74 ssherr-libcrypto.c \ 75 sshkey.c \ 76 ttymodes.c \ 77 uidswap.c \ 78 umac.c \ 79 umac128.c \ 80 utf8.c \ 81 xmalloc.c 82 83 OPENSSL_SRCS=\ 84 dh.c \ 85 digest-openssl.c \ 86 kexdh.c \ 87 kexecdh.c \ 88 kexgex.c \ 89 kexgexc.c \ 90 sshbuf-getput-crypto.c \ 91 ssh-ecdsa.c \ 92 ssh-ecdsa-sk.c \ 93 ssh-rsa.c 94 95 SRCS+= fmt_scaled.c 96 SRCS+= readpassphrase.c getpeereid.c getrrsetbyname.c 97 COPTS.monitor_fdpass.c+=-Wno-stack-protector 98 COPTS.sntrup761.c+= -Wno-stack-protector 99 100 .ifdef WITH_OPENSSL 101 SRCS+= ${OPENSSL_SRCS} 102 LIBDPLIBS+= crypto ${NETBSDSRCDIR}/crypto/external/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto 103 .else 104 SRCS+= cipher-aesctr.c digest-libc.c rijndael.c 105 .endif 106 107 CPPFLAGS+= -DHAVE_BLF_H 108 109 CPPFLAGS+= -I${SSHDIST} 110 .PATH: ${SSHDIST} 111 112 LIBDPLIBS+= crypt ${NETBSDSRCDIR}/lib/libcrypt \ 113 z ${NETBSDSRCDIR}/lib/libz 114 115 .for f in dns channels hostfile ssh-pkcs11 116 COPTS.${f}.c+= -Wno-pointer-sign 117 .endfor 118 119 # XXX 120 COPTS.channels.c+= -fno-strict-aliasing 121 122 COPTS.hostfile.c+= ${CC_WNO_FORMAT_TRUNCATION} 123 COPTS.sshkey.c+= ${CC_WNO_FORMAT_TRUNCATION} 124 COPTS.cipher.c+= -Wno-error=deprecated-declarations 125 COPTS.dh.c+= -Wno-error=deprecated-declarations 126 COPTS.digest-libc.c+= -Wno-error=cast-function-type 127 COPTS.kex.c+= -Wno-error=deprecated-declarations 128 COPTS.kexdh.c+= -Wno-error=deprecated-declarations 129 COPTS.kexecdh.c+= -Wno-error=deprecated-declarations 130 COPTS.kexgexc.c+= -Wno-error=deprecated-declarations 131 COPTS.ssh-ecdsa-sk.c+= -Wno-error=deprecated-declarations 132 COPTS.ssh-ecdsa.c+= -Wno-error=deprecated-declarations 133 COPTS.ssh-pkcs11.c+= -Wno-error=deprecated-declarations 134 COPTS.ssh-rsa.c+= -Wno-error=deprecated-declarations 135 COPTS.sshbuf-getput-crypto.c+= -Wno-error=deprecated-declarations 136 COPTS.sshkey.c+= -Wno-error=deprecated-declarations 137 COPTS.umac.c+= -Wno-error=deprecated-declarations 138 COPTS.umac128.c+= -Wno-error=deprecated-declarations 139 COPTS.ssherr-libcrypto.c+= -Wno-error=deprecated-declarations 140 COPTS.kexmlkem768x25519.c+=${${ACTIVE_CC} == "clang":? -Wno-error=missing-noreturn:} 141 142 143 144 .include <bsd.lib.mk> 145