1 # $NetBSD: Makefile,v 1.42.2.1 2026/01/22 19:51:52 martin 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 dh.c \ 38 dispatch.c \ 39 dns.c \ 40 ed25519.c \ 41 fatal.c \ 42 freezero.c \ 43 hash.c \ 44 hmac.c \ 45 hostfile.c \ 46 kex.c \ 47 kex-names.c \ 48 kexdh.c \ 49 kexecdh.c \ 50 kexgen.c \ 51 kexgex.c \ 52 kexgexc.c \ 53 kexmlkem768x25519.c \ 54 kexsntrup761x25519.c \ 55 krl.c \ 56 log.c \ 57 mac.c \ 58 match.c \ 59 misc.c \ 60 monitor_fdpass.c \ 61 msg.c \ 62 nchan.c \ 63 packet.c \ 64 poly1305.c \ 65 progressmeter.c \ 66 readpass.c \ 67 recallocarray.c \ 68 smult_curve25519_ref.c \ 69 sntrup761.c \ 70 ssh-ed25519.c \ 71 ssh-ed25519-sk.c \ 72 ssh-pkcs11.c \ 73 ssh-sk-client.c \ 74 ssh-xmss.c \ 75 sshbuf-getput-basic.c \ 76 sshbuf-getput-crypto.c \ 77 sshbuf-misc.c \ 78 sshbuf-io.c \ 79 sshbuf.c \ 80 ssherr.c \ 81 sshkey-xmss.c \ 82 sshkey.c \ 83 ttymodes.c \ 84 uidswap.c \ 85 umac.c \ 86 umac128.c \ 87 utf8.c \ 88 xmalloc.c \ 89 xmss_commons.c \ 90 xmss_fast.c \ 91 xmss_hash.c \ 92 xmss_hash_address.c \ 93 xmss_wots.c 94 95 OPENSSL_SRCS=\ 96 digest-openssl.c \ 97 kexc25519.c \ 98 ssh-dss.c \ 99 ssh-ecdsa.c \ 100 ssh-ecdsa-sk.c \ 101 ssh-rsa.c 102 103 SRCS+= fmt_scaled.c 104 SRCS+= readpassphrase.c getpeereid.c getrrsetbyname.c 105 COPTS.monitor_fdpass.c+=-Wno-stack-protector 106 COPTS.xmss_fast.c+= -Wno-stack-protector 107 COPTS.xmss_hash.c+= -Wno-stack-protector 108 COPTS.xmss_wots.c+= -Wno-stack-protector 109 COPTS.sntrup761.c+= -Wno-stack-protector 110 111 .if WITH_OPENSSL 112 SRCS+= ${OPENSSL_SRCS} 113 .else 114 SRCS+= digest-libc.c 115 .endif 116 117 CPPFLAGS+= -DHAVE_BLF_H 118 119 CPPFLAGS+= -I${SSHDIST} 120 .PATH: ${SSHDIST} 121 122 LIBDPLIBS+= crypto ${NETBSDSRCDIR}/crypto/external/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto \ 123 crypt ${NETBSDSRCDIR}/lib/libcrypt \ 124 z ${NETBSDSRCDIR}/lib/libz 125 126 .for f in dns channels hostfile ssh-pkcs11 127 COPTS.${f}.c+= -Wno-pointer-sign 128 .endfor 129 130 # XXX 131 COPTS.channels.c+= -fno-strict-aliasing 132 133 COPTS.hostfile.c+= ${CC_WNO_FORMAT_TRUNCATION} 134 COPTS.sshkey.c+= ${CC_WNO_FORMAT_TRUNCATION} 135 COPTS.cipher.c+= -Wno-error=deprecated-declarations 136 COPTS.dh.c+= -Wno-error=deprecated-declarations 137 COPTS.kex.c+= -Wno-error=deprecated-declarations 138 COPTS.kexdh.c+= -Wno-error=deprecated-declarations 139 COPTS.kexecdh.c+= -Wno-error=deprecated-declarations 140 COPTS.kexgexc.c+= -Wno-error=deprecated-declarations 141 COPTS.ssh-dss.c+= -Wno-error=deprecated-declarations 142 COPTS.ssh-ecdsa-sk.c+= -Wno-error=deprecated-declarations 143 COPTS.ssh-ecdsa.c+= -Wno-error=deprecated-declarations 144 COPTS.ssh-pkcs11.c+= -Wno-error=deprecated-declarations 145 COPTS.ssh-rsa.c+= -Wno-error=deprecated-declarations 146 COPTS.sshbuf-getput-crypto.c+= -Wno-error=deprecated-declarations 147 COPTS.sshkey.c+= -Wno-error=deprecated-declarations 148 COPTS.umac.c+= -Wno-error=deprecated-declarations 149 COPTS.umac128.c+= -Wno-error=deprecated-declarations 150 COPTS.kexmlkem768x25519.c+=${${ACTIVE_CC} == "clang":? -Wno-error=missing-noreturn:} 151 152 153 154 .include <bsd.lib.mk> 155