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