blob: a569bb95aac6c4b6a3266c9fcafb3ada6d171745 [file] [log] [blame]
Damien Miller10479cc2018-04-10 10:19:02 +10001# uncomment if you run a non bourne compatible shell. Ie. csh
Tim Ricea7a5d6d2002-05-09 07:05:59 -07002#SHELL = @SH@
Damien Millerb797b922001-02-04 23:27:00 +11003
Damien Millerf58c6722002-05-13 13:15:42 +10004AUTORECONF=autoreconf
5
Damien Miller7f6ea021999-10-28 13:25:17 +10006prefix=@prefix@
7exec_prefix=@exec_prefix@
8bindir=@bindir@
9sbindir=@sbindir@
Damien Millere2324551999-11-19 17:18:57 +110010libexecdir=@libexecdir@
Damien Millerd97c2ce2001-09-18 15:06:21 +100011datadir=@datadir@
Tim Ricebcf8be32006-10-23 14:44:47 -070012datarootdir=@datarootdir@
Damien Miller94388161999-10-29 09:57:31 +100013mandir=@mandir@
Ben Lindstrombc709922001-04-18 18:04:21 +000014mansubdir=@mansubdir@
Damien Miller296a5461999-11-13 10:48:51 +110015sysconfdir=@sysconfdir@
Damien Millerb13c73e2000-01-17 22:02:17 +110016piddir=@piddir@
17srcdir=@srcdir@
18top_srcdir=@top_srcdir@
Damien Miller7f6ea021999-10-28 13:25:17 +100019
Damien Miller7d7c60d2000-01-26 14:37:48 +110020DESTDIR=
Damien Millerc0d73901999-12-27 09:23:58 +110021VPATH=@srcdir@
Damien Millerc7b38ce1999-11-09 10:28:04 +110022SSH_PROGRAM=@bindir@/ssh
Damien Miller606f8802000-09-16 15:39:56 +110023ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
Damien Millerd7686fd2001-02-10 00:40:03 +110024SFTP_SERVER=$(libexecdir)/sftp-server
Ben Lindstromdb41d232002-06-07 03:11:38 +000025SSH_KEYSIGN=$(libexecdir)/ssh-keysign
Damien Miller7ea845e2010-02-12 09:21:02 +110026SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
djm@openbsd.org07da39f2019-10-31 21:22:01 +000027SSH_SK_HELPER=$(libexecdir)/ssh-sk-helper
Damien Millerf58c6722002-05-13 13:15:42 +100028PRIVSEP_PATH=@PRIVSEP_PATH@
Damien Millerd3f6ad22002-06-25 10:24:47 +100029SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
Damien Miller7d901272003-01-13 16:55:22 +110030STRIP_OPT=@STRIP_OPT@
Damien Miller41c8de22014-08-30 16:23:06 +100031TEST_SHELL=@TEST_SHELL@
Damien Millerd7686fd2001-02-10 00:40:03 +110032
Damien Miller05eda432002-02-10 18:32:28 +110033PATHS= -DSSHDIR=\"$(sysconfdir)\" \
Damien Millerd7686fd2001-02-10 00:40:03 +110034 -D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
35 -D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \
Ben Lindstrombc709922001-04-18 18:04:21 +000036 -D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \
Ben Lindstromdb41d232002-06-07 03:11:38 +000037 -D_PATH_SSH_KEY_SIGN=\"$(SSH_KEYSIGN)\" \
Damien Miller7ea845e2010-02-12 09:21:02 +110038 -D_PATH_SSH_PKCS11_HELPER=\"$(SSH_PKCS11_HELPER)\" \
djm@openbsd.org07da39f2019-10-31 21:22:01 +000039 -D_PATH_SSH_SK_HELPER=\"$(SSH_SK_HELPER)\" \
Damien Miller62116dc2001-12-24 01:41:47 +110040 -D_PATH_SSH_PIDDIR=\"$(piddir)\" \
Darren Tucker29c71512013-03-05 21:50:09 +110041 -D_PATH_PRIVSEP_CHROOT_DIR=\"$(PRIVSEP_PATH)\"
Damien Millerc7b38ce1999-11-09 10:28:04 +110042
Damien Miller7f6ea021999-10-28 13:25:17 +100043CC=@CC@
Damien Miller166bd442000-03-16 10:48:25 +110044LD=@LD@
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000045CFLAGS=@CFLAGS@
Damien Miller3c027682001-03-14 11:39:45 +110046CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
Damien Millerd3dcfaf1999-11-09 13:52:33 +110047LIBS=@LIBS@
Darren Tucker964de182013-02-22 10:39:59 +110048K5LIBS=@K5LIBS@
49GSSLIBS=@GSSLIBS@
Damien Miller71adf122011-01-25 12:16:15 +110050SSHLIBS=@SSHLIBS@
Damien Miller1b06dc32006-08-31 03:24:41 +100051SSHDLIBS=@SSHDLIBS@
Darren Tucker16bcc1c2004-11-07 20:14:34 +110052LIBEDIT=@LIBEDIT@
Damien Miller7f6ea021999-10-28 13:25:17 +100053AR=@AR@
Darren Tucker167bd9c2003-09-07 12:34:54 +100054AWK=@AWK@
Damien Miller7f6ea021999-10-28 13:25:17 +100055RANLIB=@RANLIB@
Damien Millerd8087f61999-11-25 12:31:26 +110056INSTALL=@INSTALL@
Tim Riced0d7a8b2003-01-08 17:22:59 -080057SED=@SED@
Damien Miller8d1fd572000-05-17 21:34:07 +100058ENT=@ENT@
Damien Millera19cf472000-11-29 13:28:50 +110059XAUTH_PATH=@XAUTH_PATH@
Ben Lindstrom3c06f6a2001-01-31 21:52:01 +000060LDFLAGS=-L. -Lopenbsd-compat/ @LDFLAGS@
Damien Millerbac2d8a2000-09-05 16:13:06 +110061EXEEXT=@EXEEXT@
Damien Miller30a69e72011-01-04 08:16:27 +110062MANFMT=@MANFMT@
Darren Tucker6c8a2462017-12-01 17:11:47 +110063MKDIR_P=@MKDIR_P@
Damien Miller7f6ea021999-10-28 13:25:17 +100064
djm@openbsd.org07da39f2019-10-31 21:22:01 +000065TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) ssh-sk-helper$(EXEEXT)
Damien Miller7f6ea021999-10-28 13:25:17 +100066
markus@openbsd.org1b11ea72018-02-23 15:58:37 +000067XMSS_OBJS=\
Damien Miller612faa32018-02-26 12:17:55 +110068 ssh-xmss.o \
69 sshkey-xmss.o \
70 xmss_commons.o \
71 xmss_fast.o \
72 xmss_hash.o \
73 xmss_hash_address.o \
74 xmss_wots.o
markus@openbsd.org1b11ea72018-02-23 15:58:37 +000075
Damien Millere5b9f0f2014-05-15 14:58:07 +100076LIBOPENSSH_OBJS=\
markus@openbsd.orgf582f0e2015-01-19 20:30:23 +000077 ssh_api.o \
Damien Millere5b9f0f2014-05-15 14:58:07 +100078 ssherr.o \
79 sshbuf.o \
Damien Millerdd8b1dd2014-07-02 17:38:31 +100080 sshkey.o \
Damien Millere5b9f0f2014-05-15 14:58:07 +100081 sshbuf-getput-basic.o \
82 sshbuf-misc.o \
djm@openbsd.orga165bab2015-01-14 15:02:39 +000083 sshbuf-getput-crypto.o \
84 krl.o \
markus@openbsd.org1b11ea72018-02-23 15:58:37 +000085 bitmap.o \
86 ${XMSS_OBJS}
Damien Millere5b9f0f2014-05-15 14:58:07 +100087
88LIBSSH_OBJS=${LIBOPENSSH_OBJS} \
markus@openbsd.orgcb30cd42018-07-09 21:56:06 +000089 authfd.o authfile.o \
Damien Miller72ef7c12015-01-15 02:21:31 +110090 canohost.o channels.o cipher.o cipher-aes.o cipher-aesctr.o \
djm@openbsd.orgcdccebd2017-04-30 23:15:04 +000091 cipher-ctr.o cleanup.o \
dtucker@openbsd.org56965122019-04-18 07:32:56 +000092 compat.o fatal.o hostfile.o \
djm@openbsd.org245c6a02019-01-19 21:45:31 +000093 log.o match.o moduli.o nchan.o packet.o \
djm@openbsd.org83fa3a02017-07-01 13:50:45 +000094 readpass.o ttymodes.o xmalloc.o addrmatch.o \
djm@openbsd.org16dd8b22019-07-16 13:18:39 +000095 atomicio.o dispatch.o mac.o misc.o utf8.o \
djm@openbsd.org02bb0762019-10-31 21:15:14 +000096 monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-ecdsa-sk.o \
97 ssh-rsa.o dh.o \
Darren Tucker992faad2012-10-05 11:38:24 +100098 msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \
djm@openbsd.orga165bab2015-01-14 15:02:39 +000099 ssh-pkcs11.o smult_curve25519_ref.o \
markus@openbsd.orgf582f0e2015-01-19 20:30:23 +0000100 poly1305.o chacha.o cipher-chachapoly.o \
djm@openbsd.orged3467c2019-10-31 21:16:20 +0000101 ssh-ed25519.o ssh-sk.o digest-openssl.o digest-libc.o hmac.o \
Damien Miller748dd8e2017-12-19 16:17:59 +1100102 sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o \
markus@openbsd.orgf582f0e2015-01-19 20:30:23 +0000103 kex.o kexdh.o kexgex.o kexecdh.o kexc25519.o \
djm@openbsd.org92dda342019-01-21 10:29:56 +0000104 kexgexc.o kexgexs.o \
djm@openbsd.orgaaca72d2019-01-21 10:40:11 +0000105 sntrup4591761.o kexsntrup4591761x25519.o kexgen.o \
Darren Tuckerb236b272019-11-03 00:10:43 +1100106 sftp-realpath.o platform-pledge.o platform-tracing.o platform-misc.o
Damien Miller18ccf851999-12-16 13:06:18 +1100107
djm@openbsd.orgdfd59162019-01-21 10:20:12 +0000108
Damien Millerd1940482003-02-24 12:18:46 +1100109SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
djm@openbsd.orge6882462017-04-30 23:17:37 +0000110 sshconnect.o sshconnect2.o mux.o
Damien Millere72b7af1999-12-30 15:08:44 +1100111
markus@openbsd.org6cb6dcf2016-08-13 17:47:40 +0000112SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o \
Damien Miller878e0292017-08-25 13:25:01 +1000113 audit.o audit-bsm.o audit-linux.o platform.o \
Darren Tucker25f60a72004-08-15 17:23:34 +1000114 sshpty.o sshlogin.o servconf.o serverloop.o \
markus@openbsd.org6cb6dcf2016-08-13 17:47:40 +0000115 auth.o auth2.o auth-options.o session.o \
116 auth2-chall.o groupaccess.o \
Damien Miller87f08be2018-07-20 13:18:28 +1000117 auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
Damien Miller7cc194f2014-02-04 11:12:56 +1100118 auth2-none.o auth2-passwd.o auth2-pubkey.o \
djm@openbsd.org0082fba2016-09-28 16:33:06 +0000119 monitor.o monitor_wrap.o auth-krb5.o \
Darren Tucker49aaf4a2003-08-26 11:58:16 +1000120 auth2-gss.o gss-serv.o gss-serv-krb5.o \
Darren Tuckerd9f88912005-02-20 21:01:48 +1100121 loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
Darren Tuckerb236b272019-11-03 00:10:43 +1100122 sftp-server.o sftp-common.o \
Damien Millere0956e32012-04-04 11:27:54 +1000123 sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \
Damien Miller4626cba2016-01-08 14:24:56 +1100124 sandbox-seccomp-filter.o sandbox-capsicum.o sandbox-pledge.o \
dtucker@openbsd.org258dc8b2018-07-18 11:34:04 +0000125 sandbox-solaris.o uidswap.o
Damien Millere72b7af1999-12-30 15:08:44 +1100126
Damien Millerf22019b2011-05-05 13:48:37 +1000127MANPAGES = moduli.5.out scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out ssh-keysign.8.out ssh-pkcs11-helper.8.out sshd_config.5.out ssh_config.5.out
128MANPAGES_IN = moduli.5 scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 ssh-keysign.8 ssh-pkcs11-helper.8 sshd_config.5 ssh_config.5
Damien Miller897741e2001-04-16 10:41:46 +1000129MANTYPE = @MANTYPE@
Damien Miller645c5982000-01-03 14:42:09 +1100130
Damien Millerb5b0af42001-06-27 21:52:32 +1000131CONFIGFILES=sshd_config.out ssh_config.out moduli.out
132CONFIGFILES_IN=sshd_config ssh_config moduli
Damien Miller645c5982000-01-03 14:42:09 +1100133
Damien Millera19cf472000-11-29 13:28:50 +1100134PATHSUBS = \
Tim Riced0d7a8b2003-01-08 17:22:59 -0800135 -e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \
136 -e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \
137 -e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
138 -e 's|/usr/libexec|$(libexecdir)|g' \
139 -e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
140 -e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
Damien Millere63b7f22011-01-09 09:19:50 +1100141 -e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \
Tim Riced0d7a8b2003-01-08 17:22:59 -0800142 -e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
143 -e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
Damien Millerda3ca352013-12-07 21:43:46 +1100144 -e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \
Tim Riced0d7a8b2003-01-08 17:22:59 -0800145 -e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
Damien Miller60dcc622008-06-26 15:59:32 +1000146 -e 's|/etc/moduli|$(sysconfdir)/moduli|g' \
Tim Riced0d7a8b2003-01-08 17:22:59 -0800147 -e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
Darren Tucker12259d92006-08-22 22:24:10 +1000148 -e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \
Tim Riced0d7a8b2003-01-08 17:22:59 -0800149 -e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \
150 -e 's|/var/empty|$(PRIVSEP_PATH)|g' \
151 -e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g'
Damien Miller886c63a2000-01-20 23:13:36 +1100152
Tim Riced0d7a8b2003-01-08 17:22:59 -0800153FIXPATHSCMD = $(SED) $(PATHSUBS)
Darren Tucker6d8bd572013-06-11 11:26:10 +1000154FIXALGORITHMSCMD= $(SHELL) $(srcdir)/fixalgorithms $(SED) \
155 @UNSUPPORTED_ALGORITHMS@
Damien Miller886c63a2000-01-20 23:13:36 +1100156
Damien Miller182297c2019-09-05 20:34:54 +1000157all: configure-check $(CONFIGFILES) $(MANPAGES) $(TARGETS)
Damien Miller18ccf851999-12-16 13:06:18 +1100158
Damien Millereff041d2003-05-15 21:33:46 +1000159$(LIBSSH_OBJS): Makefile.in config.h
160$(SSHOBJS): Makefile.in config.h
161$(SSHDOBJS): Makefile.in config.h
Darren Tuckerfd7a2de2019-09-06 14:07:10 +1000162configure-check: $(srcdir)/configure
Damien Miller182297c2019-09-05 20:34:54 +1000163
Darren Tuckerfd7a2de2019-09-06 14:07:10 +1000164$(srcdir)/configure: configure.ac aclocal.m4
Damien Millerafdf27f2019-09-05 21:38:40 +1000165 @echo "ERROR: configure is out of date; please run ${AUTORECONF} (and configure)" 1>&2
Damien Miller182297c2019-09-05 20:34:54 +1000166 @exit 1
Damien Miller16e519c2000-05-09 14:28:55 +1000167
Ben Lindstromf5410352000-12-29 21:37:22 +0000168.c.o:
Damien Millere7429f22014-05-15 18:01:01 +1000169 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
Ben Lindstromf5410352000-12-29 21:37:22 +0000170
Ben Lindstrome03c85d2001-02-01 14:06:11 +0000171LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
Tim Rice13aae5e2001-10-21 17:53:58 -0700172$(LIBCOMPAT): always
Damien Millerf41d6182001-11-12 10:34:22 +1100173 (cd openbsd-compat && $(MAKE))
Tim Rice13aae5e2001-10-21 17:53:58 -0700174always:
Damien Miller7f6ea021999-10-28 13:25:17 +1000175
Damien Miller16e519c2000-05-09 14:28:55 +1000176libssh.a: $(LIBSSH_OBJS)
177 $(AR) rv $@ $(LIBSSH_OBJS)
178 $(RANLIB) $@
Damien Miller7f6ea021999-10-28 13:25:17 +1000179
Ben Lindstrome03c85d2001-02-01 14:06:11 +0000180ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
Darren Tucker964de182013-02-22 10:39:59 +1100181 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS) $(GSSLIBS)
Damien Miller7f6ea021999-10-28 13:25:17 +1000182
Ben Lindstrome03c85d2001-02-01 14:06:11 +0000183sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
Darren Tucker964de182013-02-22 10:39:59 +1100184 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS)
Damien Miller7f6ea021999-10-28 13:25:17 +1000185
Damien Miller62d57f62003-01-10 21:43:24 +1100186scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
markus@openbsd.orgcb30cd42018-07-09 21:56:06 +0000187 $(LD) -o $@ scp.o progressmeter.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
Damien Miller7f6ea021999-10-28 13:25:17 +1000188
Kevin Stevesbe48f2b2001-04-06 01:58:37 +0000189ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
Damien Millera8e06ce2003-11-21 23:48:55 +1100190 $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
Damien Miller7f6ea021999-10-28 13:25:17 +1000191
Damien Miller7ea845e2010-02-12 09:21:02 +1100192ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o
193 $(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
Damien Miller16e519c2000-05-09 14:28:55 +1000194
djm@openbsd.org2a9c9f72019-09-03 08:34:19 +0000195ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o sshsig.o
Damien Miller1a72c0d2019-09-03 18:44:10 +1000196 $(LD) -o $@ ssh-keygen.o sshsig.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
Damien Miller7f6ea021999-10-28 13:25:17 +1000197
djm@openbsd.org0a843d92018-12-27 03:25:24 +0000198ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o readconf.o uidswap.o compat.o
dtucker@openbsd.org258dc8b2018-07-18 11:34:04 +0000199 $(LD) -o $@ ssh-keysign.o readconf.o uidswap.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
Ben Lindstrom1bad2562002-06-06 19:57:33 +0000200
Damien Miller7ea845e2010-02-12 09:21:02 +1100201ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o
Darren Tucker5b6d0d02010-05-12 16:51:38 +1000202 $(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
Damien Miller7ea845e2010-02-12 09:21:02 +1100203
djm@openbsd.org07da39f2019-10-31 21:22:01 +0000204ssh-sk-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-sk-helper.o
205 $(LD) -o $@ ssh-sk-helper.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
206
markus@openbsd.orga3068632016-01-14 16:17:39 +0000207ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
208 $(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
Ben Lindstromb6434ae2000-12-05 01:15:09 +0000209
Darren Tuckerb236b272019-11-03 00:10:43 +1100210sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o
211 $(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
Damien Miller33804262001-02-04 23:20:18 +1100212
Damien Miller20e1fab2004-02-18 14:30:55 +1100213sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100214 $(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
Damien Miller7b28dc52000-09-05 13:34:53 +1100215
andre2ff7b5d2000-06-03 14:57:40 +0000216# test driver for the loginrec code - not built by default
Kevin Stevesbe48f2b2001-04-06 01:58:37 +0000217logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
218 $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
andre2ff7b5d2000-06-03 14:57:40 +0000219
Ben Lindstrom38862182001-04-27 00:31:07 +0000220$(MANPAGES): $(MANPAGES_IN)
Damien Miller897741e2001-04-16 10:41:46 +1000221 if test "$(MANTYPE)" = "cat"; then \
Ben Lindstrom38862182001-04-27 00:31:07 +0000222 manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
Damien Miller897741e2001-04-16 10:41:46 +1000223 else \
Ben Lindstrom38862182001-04-27 00:31:07 +0000224 manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
Damien Miller897741e2001-04-16 10:41:46 +1000225 fi; \
226 if test "$(MANTYPE)" = "man"; then \
Darren Tucker6d8bd572013-06-11 11:26:10 +1000227 $(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) | \
228 $(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
Damien Miller897741e2001-04-16 10:41:46 +1000229 else \
Darren Tucker6d8bd572013-06-11 11:26:10 +1000230 $(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) > $@; \
Damien Miller897741e2001-04-16 10:41:46 +1000231 fi
232
Ben Lindstrom38862182001-04-27 00:31:07 +0000233$(CONFIGFILES): $(CONFIGFILES_IN)
234 conffile=`echo $@ | sed 's/.out$$//'`; \
235 $(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
Damien Miller645c5982000-01-03 14:42:09 +1100236
Darren Tuckerd188a122005-05-29 17:22:29 +1000237# fake rule to stop make trying to compile moduli.o into a binary "moduli.o"
Darren Tuckerb2f9d412003-08-02 23:51:38 +1000238moduli:
239 echo
240
Darren Tucker782390e2003-09-22 10:58:55 +1000241clean: regressclean
Damien Millera8e06ce2003-11-21 23:48:55 +1100242 rm -f *.o *.a $(TARGETS) logintest config.cache config.log
Darren Tucker72c025d2005-01-18 12:05:18 +1100243 rm -f *.out core survey
Damien Miller6bdf70f2017-05-09 14:35:03 +1000244 rm -f regress/check-perm$(EXEEXT)
Damien Millerc59aca82018-07-20 14:53:42 +1000245 rm -f regress/mkdtemp$(EXEEXT)
Damien Millere7429f22014-05-15 18:01:01 +1000246 rm -f regress/unittests/test_helper/*.a
247 rm -f regress/unittests/test_helper/*.o
248 rm -f regress/unittests/sshbuf/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000249 rm -f regress/unittests/sshbuf/test_sshbuf$(EXEEXT)
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000250 rm -f regress/unittests/sshkey/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000251 rm -f regress/unittests/sshkey/test_sshkey$(EXEEXT)
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000252 rm -f regress/unittests/bitmap/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000253 rm -f regress/unittests/bitmap/test_bitmap$(EXEEXT)
Darren Tuckerb1b22dd2017-03-14 14:19:36 +1100254 rm -f regress/unittests/conversion/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000255 rm -f regress/unittests/conversion/test_conversion$(EXEEXT)
Damien Millere89c7802015-02-17 10:04:55 +1100256 rm -f regress/unittests/hostkeys/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000257 rm -f regress/unittests/hostkeys/test_hostkeys$(EXEEXT)
markus@openbsd.orgc78a5782015-01-19 20:45:25 +0000258 rm -f regress/unittests/kex/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000259 rm -f regress/unittests/kex/test_kex$(EXEEXT)
Damien Miller6ee4f1c2016-08-23 16:33:48 +1000260 rm -f regress/unittests/match/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000261 rm -f regress/unittests/match/test_match$(EXEEXT)
Damien Miller6ee4f1c2016-08-23 16:33:48 +1000262 rm -f regress/unittests/utf8/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000263 rm -f regress/unittests/utf8/test_utf8$(EXEEXT)
Darren Tucker8199d032016-07-18 13:47:39 +1000264 rm -f regress/misc/kexfuzz/*.o
Damien Miller6bdf70f2017-05-09 14:35:03 +1000265 rm -f regress/misc/kexfuzz/kexfuzz$(EXEEXT)
Damien Millerf41d6182001-11-12 10:34:22 +1100266 (cd openbsd-compat && $(MAKE) clean)
Damien Miller34132e52000-01-14 15:45:46 +1100267
Darren Tucker782390e2003-09-22 10:58:55 +1000268distclean: regressclean
Damien Millera8e06ce2003-11-21 23:48:55 +1100269 rm -f *.o *.a $(TARGETS) logintest config.cache config.log
Damien Miller223897a2006-09-12 21:54:10 +1000270 rm -f *.out core opensshd.init openssh.xml
Damien Millerf22019b2011-05-05 13:48:37 +1000271 rm -f Makefile buildpkg.sh config.h config.status
Damien Miller24f2a422006-07-24 15:30:18 +1000272 rm -f survey.sh openbsd-compat/regress/Makefile *~
Damien Miller7c734052001-10-12 19:15:27 +1000273 rm -rf autom4te.cache
Damien Millerc59aca82018-07-20 14:53:42 +1000274 rm -f regress/check-perm
275 rm -f regress/mkdtemp
Damien Millere7429f22014-05-15 18:01:01 +1000276 rm -f regress/unittests/test_helper/*.a
277 rm -f regress/unittests/test_helper/*.o
278 rm -f regress/unittests/sshbuf/*.o
279 rm -f regress/unittests/sshbuf/test_sshbuf
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000280 rm -f regress/unittests/sshkey/*.o
281 rm -f regress/unittests/sshkey/test_sshkey
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000282 rm -f regress/unittests/bitmap/*.o
283 rm -f regress/unittests/bitmap/test_bitmap
Darren Tuckerb1b22dd2017-03-14 14:19:36 +1100284 rm -f regress/unittests/conversion/*.o
285 rm -f regress/unittests/conversion/test_conversion
Damien Millere89c7802015-02-17 10:04:55 +1100286 rm -f regress/unittests/hostkeys/*.o
287 rm -f regress/unittests/hostkeys/test_hostkeys
markus@openbsd.orgc78a5782015-01-19 20:45:25 +0000288 rm -f regress/unittests/kex/*.o
289 rm -f regress/unittests/kex/test_kex
Damien Miller6ee4f1c2016-08-23 16:33:48 +1000290 rm -f regress/unittests/match/*.o
291 rm -f regress/unittests/match/test_match
292 rm -f regress/unittests/utf8/*.o
293 rm -f regress/unittests/utf8/test_utf8
Damien Miller6aa1bf42018-07-12 14:54:18 +1000294 rm -f regress/misc/kexfuzz/*.o
Damien Miller41c115a2018-09-12 16:50:01 +1000295 rm -f regress/misc/kexfuzz/kexfuzz$(EXEEXT)
Damien Millerf41d6182001-11-12 10:34:22 +1100296 (cd openbsd-compat && $(MAKE) distclean)
Tim Rice6f1f7582004-05-30 21:38:51 -0700297 if test -d pkg ; then \
298 rm -fr pkg ; \
299 fi
Damien Miller8f6bc302001-07-14 13:07:43 +1000300
Damien Millera47f5262003-05-15 13:23:07 +1000301veryclean: distclean
Damien Miller8f6bc302001-07-14 13:07:43 +1000302 rm -f configure config.h.in *.0
Damien Miller34132e52000-01-14 15:45:46 +1100303
Damien Miller7741ce82011-08-06 06:15:15 +1000304cleandir: veryclean
305
Damien Millera47f5262003-05-15 13:23:07 +1000306mrproper: veryclean
307
308realclean: veryclean
Damien Miller34132e52000-01-14 15:45:46 +1100309
Ben Lindstrome2e66a22001-04-18 15:46:01 +0000310catman-do:
Ben Lindstrom38862182001-04-27 00:31:07 +0000311 @for f in $(MANPAGES_IN) ; do \
Ben Lindstrome2e66a22001-04-18 15:46:01 +0000312 base=`echo $$f | sed 's/\..*$$//'` ; \
313 echo "$$f -> $$base.0" ; \
Damien Miller30a69e72011-01-04 08:16:27 +1100314 $(MANFMT) $$f | cat -v | sed -e 's/.\^H//g' \
Ben Lindstrome2e66a22001-04-18 15:46:01 +0000315 >$$base.0 ; \
316 done
Damien Miller34132e52000-01-14 15:45:46 +1100317
Darren Tucker79c0e1d2017-12-11 14:38:33 +1100318depend: depend-rebuild
319 rm -f .depend.bak
320
321depend-rebuild:
Darren Tucker2d96f282017-12-11 16:21:55 +1100322 rm -f config.h
323 touch config.h
Darren Tucker5299a092019-07-19 13:50:25 +1000324 makedepend -w1000 -Y. -f .depend *.c 2>/dev/null
Darren Tucker2d96f282017-12-11 16:21:55 +1100325 rm -f config.h
Darren Tucker79c0e1d2017-12-11 14:38:33 +1100326
327depend-check: depend-rebuild
328 cmp .depend .depend.bak || (echo .depend stale && exit 1)
329
330distprep: catman-do depend-check
Damien Millerf58c6722002-05-13 13:15:42 +1000331 $(AUTORECONF)
Darren Tucker79c0e1d2017-12-11 14:38:33 +1100332 -rm -rf autom4te.cache .depend.bak
Damien Miller262ff172000-06-28 08:24:49 +1000333
Damien Millerf22019b2011-05-05 13:48:37 +1000334install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
335install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf
336install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
Damien Miller099f5052000-06-22 20:57:11 +1000337
Tim Rice95210192002-07-14 10:02:20 -0700338check-config:
339 -$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
Damien Millerd3f6ad22002-06-25 10:24:47 +1000340
Damien Millerd8f60022010-02-12 09:34:22 +1100341install-files:
Darren Tucker6c8a2462017-12-01 17:11:47 +1100342 $(MKDIR_P) $(DESTDIR)$(bindir)
343 $(MKDIR_P) $(DESTDIR)$(sbindir)
344 $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)1
345 $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)5
346 $(MKDIR_P) $(DESTDIR)$(mandir)/$(mansubdir)8
347 $(MKDIR_P) $(DESTDIR)$(libexecdir)
348 $(MKDIR_P) -m 0755 $(DESTDIR)$(PRIVSEP_PATH)
Tim Riceded8fa02010-03-11 22:32:02 -0800349 $(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT)
350 $(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT)
351 $(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
352 $(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
353 $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
354 $(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
355 $(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
Tim Riceded8fa02010-03-11 22:32:02 -0800356 $(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
357 $(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
djm@openbsd.org07da39f2019-10-31 21:22:01 +0000358 $(INSTALL) -m 0755 $(STRIP_OPT) ssh-sk-helper$(EXEEXT) $(DESTDIR)$(SSH_SK_HELPER)$(EXEEXT)
Tim Riceded8fa02010-03-11 22:32:02 -0800359 $(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
360 $(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
Ben Lindstrombc709922001-04-18 18:04:21 +0000361 $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
362 $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
363 $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
364 $(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
365 $(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
366 $(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
Damien Miller60dcc622008-06-26 15:59:32 +1000367 $(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5
Ben Lindstrom90ac0b52002-06-21 01:38:53 +0000368 $(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
369 $(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
Ben Lindstrombc709922001-04-18 18:04:21 +0000370 $(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +0000371 $(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
372 $(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
Ben Lindstromdb41d232002-06-07 03:11:38 +0000373 $(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
Damien Miller43001b32010-02-24 18:18:51 +1100374 $(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
Darren Tuckerdc8fc622005-02-26 10:12:38 +1100375
376install-sysconf:
Darren Tucker6c8a2462017-12-01 17:11:47 +1100377 $(MKDIR_P) $(DESTDIR)$(sysconfdir)
Tim Rice1363b3c2002-07-12 09:04:06 -0700378 @if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
Damien Miller7d7c60d2000-01-26 14:37:48 +1100379 $(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
Damien Miller29abb1b2000-11-11 08:51:40 +1100380 else \
381 echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
Damien Miller0986b552000-11-11 08:36:38 +1100382 fi
Tim Rice1363b3c2002-07-12 09:04:06 -0700383 @if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
Damien Miller7d7c60d2000-01-26 14:37:48 +1100384 $(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
Damien Miller29abb1b2000-11-11 08:51:40 +1100385 else \
386 echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
Damien Miller296a5461999-11-13 10:48:51 +1100387 fi
Tim Rice1363b3c2002-07-12 09:04:06 -0700388 @if [ ! -f $(DESTDIR)$(sysconfdir)/moduli ]; then \
Damien Millerb5b0af42001-06-27 21:52:32 +1000389 if [ -f $(DESTDIR)$(sysconfdir)/primes ]; then \
390 echo "moving $(DESTDIR)$(sysconfdir)/primes to $(DESTDIR)$(sysconfdir)/moduli"; \
391 mv "$(DESTDIR)$(sysconfdir)/primes" "$(DESTDIR)$(sysconfdir)/moduli"; \
Damien Milleracf59e62001-06-28 20:23:14 +1000392 else \
Damien Millerb5b0af42001-06-27 21:52:32 +1000393 $(INSTALL) -m 644 moduli.out $(DESTDIR)$(sysconfdir)/moduli; \
394 fi ; \
Damien Miller29abb1b2000-11-11 08:51:40 +1100395 else \
Damien Millerb5b0af42001-06-27 21:52:32 +1000396 echo "$(DESTDIR)$(sysconfdir)/moduli already exists, install will not overwrite"; \
Damien Miller0986b552000-11-11 08:36:38 +1100397 fi
Damien Miller296a5461999-11-13 10:48:51 +1100398
Damien Millerbac2d8a2000-09-05 16:13:06 +1100399host-key: ssh-keygen$(EXEEXT)
Tim Rice1363b3c2002-07-12 09:04:06 -0700400 @if [ -z "$(DESTDIR)" ] ; then \
Darren Tuckercfffbdb2015-09-14 16:24:21 +1000401 ./ssh-keygen -A; \
402 fi
Damien Miller099f5052000-06-22 20:57:11 +1000403
Darren Tuckercfffbdb2015-09-14 16:24:21 +1000404host-key-force: ssh-keygen$(EXEEXT) ssh$(EXEEXT)
Ben Lindstrom65571522000-11-16 02:46:20 +0000405 ./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
406 ./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
Damien Millerda3ca352013-12-07 21:43:46 +1100407 ./ssh-keygen -t ed25519 -f $(DESTDIR)$(sysconfdir)/ssh_host_ed25519_key -N ""
Darren Tuckercfffbdb2015-09-14 16:24:21 +1000408 if ./ssh -Q key | grep ecdsa >/dev/null ; then \
409 ./ssh-keygen -t ecdsa -f $(DESTDIR)$(sysconfdir)/ssh_host_ecdsa_key -N ""; \
410 fi
Damien Miller4095f892000-03-03 22:13:52 +1100411
Damien Millerbf1c9b21999-12-09 10:16:54 +1100412uninstallall: uninstall
Damien Miller7d7c60d2000-01-26 14:37:48 +1100413 -rm -f $(DESTDIR)$(sysconfdir)/ssh_config
414 -rm -f $(DESTDIR)$(sysconfdir)/sshd_config
415 -rmdir $(DESTDIR)$(sysconfdir)
416 -rmdir $(DESTDIR)$(bindir)
417 -rmdir $(DESTDIR)$(sbindir)
418 -rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
419 -rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
420 -rmdir $(DESTDIR)$(mandir)
421 -rmdir $(DESTDIR)$(libexecdir)
Damien Millerbf1c9b21999-12-09 10:16:54 +1100422
Damien Millera8e06ce2003-11-21 23:48:55 +1100423uninstall:
Damien Millerbac2d8a2000-09-05 16:13:06 +1100424 -rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
425 -rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
426 -rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
427 -rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
428 -rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
Ben Lindstromb6434ae2000-12-05 01:15:09 +0000429 -rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
Damien Miller33804262001-02-04 23:20:18 +1100430 -rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100431 -rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
Damien Millerd7686fd2001-02-10 00:40:03 +1100432 -rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
Ben Lindstromdb41d232002-06-07 03:11:38 +0000433 -rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
Damien Miller7ea845e2010-02-12 09:21:02 +1100434 -rm -f $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
djm@openbsd.org07da39f2019-10-31 21:22:01 +0000435 -rm -f $(DESTDIR)$(SSH_SK_HELPER)$(EXEEXT)
Damien Miller7d7c60d2000-01-26 14:37:48 +1100436 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
437 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
438 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
439 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
440 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
Damien Miller33804262001-02-04 23:20:18 +1100441 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
Ben Lindstromb6434ae2000-12-05 01:15:09 +0000442 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
Damien Miller7d7c60d2000-01-26 14:37:48 +1100443 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000444 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
Ben Lindstromdb41d232002-06-07 03:11:38 +0000445 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
Damien Miller43001b32010-02-24 18:18:51 +1100446 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
Darren Tucker150a81c2003-09-04 13:41:06 +1000447
Damien Millere7429f22014-05-15 18:01:01 +1000448regress-prep:
Darren Tucker6c8a2462017-12-01 17:11:47 +1100449 $(MKDIR_P) `pwd`/regress/unittests/test_helper
450 $(MKDIR_P) `pwd`/regress/unittests/sshbuf
451 $(MKDIR_P) `pwd`/regress/unittests/sshkey
452 $(MKDIR_P) `pwd`/regress/unittests/bitmap
453 $(MKDIR_P) `pwd`/regress/unittests/conversion
454 $(MKDIR_P) `pwd`/regress/unittests/hostkeys
455 $(MKDIR_P) `pwd`/regress/unittests/kex
456 $(MKDIR_P) `pwd`/regress/unittests/match
457 $(MKDIR_P) `pwd`/regress/unittests/utf8
458 $(MKDIR_P) `pwd`/regress/misc/kexfuzz
Damien Miller7faaa322015-02-22 07:57:27 +1100459 [ -f `pwd`/regress/Makefile ] || \
Tim Rice75db01d2013-03-22 10:14:32 -0700460 ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
Damien Millere7429f22014-05-15 18:01:01 +1000461
Darren Tuckerc71ba792016-07-18 15:43:25 +1000462REGRESSLIBS=libssh.a $(LIBCOMPAT)
463
464regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c $(REGRESSLIBS)
Darren Tuckere8b58f42016-07-18 17:22:49 +1000465 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/modpipe.c \
Tim Rice86211d12013-06-01 18:38:23 -0700466 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
Tim Ricec31db8c2013-02-19 19:01:51 -0800467
Darren Tuckerc71ba792016-07-18 15:43:25 +1000468regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c $(REGRESSLIBS)
Darren Tuckere8b58f42016-07-18 17:22:49 +1000469 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/setuid-allowed.c \
Damien Miller6d6fcd12013-12-08 15:53:28 +1100470 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
471
Darren Tuckerc71ba792016-07-18 15:43:25 +1000472regress/netcat$(EXEEXT): $(srcdir)/regress/netcat.c $(REGRESSLIBS)
Darren Tuckere8b58f42016-07-18 17:22:49 +1000473 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/netcat.c \
Tim Ricee6b95032015-02-25 09:56:48 -0800474 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
Damien Miller293cac52014-12-22 16:30:42 +1100475
Darren Tuckerc71ba792016-07-18 15:43:25 +1000476regress/check-perm$(EXEEXT): $(srcdir)/regress/check-perm.c $(REGRESSLIBS)
Darren Tuckere8b58f42016-07-18 17:22:49 +1000477 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/check-perm.c \
Damien Miller1acc0582016-02-23 16:12:13 +1100478 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
479
Damien Millerc59aca82018-07-20 14:53:42 +1000480regress/mkdtemp$(EXEEXT): $(srcdir)/regress/mkdtemp.c $(REGRESSLIBS)
481 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/regress/mkdtemp.c \
482 $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
483
Damien Millere7429f22014-05-15 18:01:01 +1000484UNITTESTS_TEST_HELPER_OBJS=\
485 regress/unittests/test_helper/test_helper.o \
486 regress/unittests/test_helper/fuzz.o
487
488regress/unittests/test_helper/libtest_helper.a: ${UNITTESTS_TEST_HELPER_OBJS}
489 $(AR) rv $@ $(UNITTESTS_TEST_HELPER_OBJS)
490 $(RANLIB) $@
491
492UNITTESTS_TEST_SSHBUF_OBJS=\
493 regress/unittests/sshbuf/tests.o \
494 regress/unittests/sshbuf/test_sshbuf.o \
495 regress/unittests/sshbuf/test_sshbuf_getput_basic.o \
496 regress/unittests/sshbuf/test_sshbuf_getput_crypto.o \
497 regress/unittests/sshbuf/test_sshbuf_misc.o \
498 regress/unittests/sshbuf/test_sshbuf_fuzz.o \
499 regress/unittests/sshbuf/test_sshbuf_getput_fuzz.o \
500 regress/unittests/sshbuf/test_sshbuf_fixed.o
501
502regress/unittests/sshbuf/test_sshbuf$(EXEEXT): ${UNITTESTS_TEST_SSHBUF_OBJS} \
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000503 regress/unittests/test_helper/libtest_helper.a libssh.a
Damien Millere7429f22014-05-15 18:01:01 +1000504 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHBUF_OBJS) \
Damien Millerc5089ec2014-08-20 11:06:20 +1000505 regress/unittests/test_helper/libtest_helper.a \
Damien Millere7429f22014-05-15 18:01:01 +1000506 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
507
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000508UNITTESTS_TEST_SSHKEY_OBJS=\
509 regress/unittests/sshkey/test_fuzz.o \
510 regress/unittests/sshkey/tests.o \
511 regress/unittests/sshkey/common.o \
512 regress/unittests/sshkey/test_file.o \
513 regress/unittests/sshkey/test_sshkey.o
514
515regress/unittests/sshkey/test_sshkey$(EXEEXT): ${UNITTESTS_TEST_SSHKEY_OBJS} \
516 regress/unittests/test_helper/libtest_helper.a libssh.a
517 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_SSHKEY_OBJS) \
Damien Milleraa6598e2014-08-21 10:47:54 +1000518 regress/unittests/test_helper/libtest_helper.a \
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000519 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
520
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000521UNITTESTS_TEST_BITMAP_OBJS=\
Damien Miller45c0fd72015-01-15 22:08:23 +1100522 regress/unittests/bitmap/tests.o
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000523
markus@openbsd.orgc78a5782015-01-19 20:45:25 +0000524regress/unittests/bitmap/test_bitmap$(EXEEXT): ${UNITTESTS_TEST_BITMAP_OBJS} \
525 regress/unittests/test_helper/libtest_helper.a libssh.a
526 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_BITMAP_OBJS) \
527 regress/unittests/test_helper/libtest_helper.a \
528 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
529
Darren Tuckerb1b22dd2017-03-14 14:19:36 +1100530UNITTESTS_TEST_CONVERSION_OBJS=\
531 regress/unittests/conversion/tests.o
532
533regress/unittests/conversion/test_conversion$(EXEEXT): \
534 ${UNITTESTS_TEST_CONVERSION_OBJS} \
535 regress/unittests/test_helper/libtest_helper.a libssh.a
536 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_CONVERSION_OBJS) \
537 regress/unittests/test_helper/libtest_helper.a \
538 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
539
Damien Miller1ca3e212015-01-20 10:11:31 +1100540UNITTESTS_TEST_KEX_OBJS=\
markus@openbsd.orgc78a5782015-01-19 20:45:25 +0000541 regress/unittests/kex/tests.o \
markus@openbsd.orga3068632016-01-14 16:17:39 +0000542 regress/unittests/kex/test_kex.o
markus@openbsd.orgc78a5782015-01-19 20:45:25 +0000543
Damien Miller1ca3e212015-01-20 10:11:31 +1100544regress/unittests/kex/test_kex$(EXEEXT): ${UNITTESTS_TEST_KEX_OBJS} \
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000545 regress/unittests/test_helper/libtest_helper.a libssh.a
Damien Miller1ca3e212015-01-20 10:11:31 +1100546 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_KEX_OBJS) \
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000547 regress/unittests/test_helper/libtest_helper.a \
548 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
549
Damien Millere89c7802015-02-17 10:04:55 +1100550UNITTESTS_TEST_HOSTKEYS_OBJS=\
551 regress/unittests/hostkeys/tests.o \
552 regress/unittests/hostkeys/test_iterate.o
553
554regress/unittests/hostkeys/test_hostkeys$(EXEEXT): \
555 ${UNITTESTS_TEST_HOSTKEYS_OBJS} \
556 regress/unittests/test_helper/libtest_helper.a libssh.a
557 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_HOSTKEYS_OBJS) \
558 regress/unittests/test_helper/libtest_helper.a \
559 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
560
Damien Miller6ee4f1c2016-08-23 16:33:48 +1000561UNITTESTS_TEST_MATCH_OBJS=\
562 regress/unittests/match/tests.o
563
564regress/unittests/match/test_match$(EXEEXT): \
565 ${UNITTESTS_TEST_MATCH_OBJS} \
566 regress/unittests/test_helper/libtest_helper.a libssh.a
567 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_MATCH_OBJS) \
568 regress/unittests/test_helper/libtest_helper.a \
569 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
570
571UNITTESTS_TEST_UTF8_OBJS=\
572 regress/unittests/utf8/tests.o
573
574regress/unittests/utf8/test_utf8$(EXEEXT): \
575 ${UNITTESTS_TEST_UTF8_OBJS} \
576 regress/unittests/test_helper/libtest_helper.a libssh.a
577 $(LD) -o $@ $(LDFLAGS) $(UNITTESTS_TEST_UTF8_OBJS) \
578 regress/unittests/test_helper/libtest_helper.a \
579 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
580
Damien Milleraf0bb382016-03-04 15:11:55 +1100581MISC_KEX_FUZZ_OBJS=\
582 regress/misc/kexfuzz/kexfuzz.o
583
584regress/misc/kexfuzz/kexfuzz$(EXEEXT): ${MISC_KEX_FUZZ_OBJS} libssh.a
585 $(LD) -o $@ $(LDFLAGS) $(MISC_KEX_FUZZ_OBJS) \
586 -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
587
Darren Tucker159e9872019-07-24 14:21:19 +1000588regress-binaries: regress-prep $(LIBCOMPAT) \
Darren Tucker520d4552019-07-24 11:20:18 +1000589 regress/modpipe$(EXEEXT) \
Damien Millere7429f22014-05-15 18:01:01 +1000590 regress/setuid-allowed$(EXEEXT) \
Damien Miller293cac52014-12-22 16:30:42 +1100591 regress/netcat$(EXEEXT) \
Damien Miller1acc0582016-02-23 16:12:13 +1100592 regress/check-perm$(EXEEXT) \
Darren Tuckere0055af2019-07-23 23:06:22 +1000593 regress/mkdtemp$(EXEEXT)
594
Darren Tucker159e9872019-07-24 14:21:19 +1000595regress-unit-binaries: regress-prep $(REGRESSLIBS) \
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000596 regress/unittests/sshbuf/test_sshbuf$(EXEEXT) \
djm@openbsd.orgd333f892015-01-15 07:36:28 +0000597 regress/unittests/sshkey/test_sshkey$(EXEEXT) \
markus@openbsd.orgc78a5782015-01-19 20:45:25 +0000598 regress/unittests/bitmap/test_bitmap$(EXEEXT) \
Darren Tuckerb1b22dd2017-03-14 14:19:36 +1100599 regress/unittests/conversion/test_conversion$(EXEEXT) \
Damien Millere89c7802015-02-17 10:04:55 +1100600 regress/unittests/hostkeys/test_hostkeys$(EXEEXT) \
Damien Milleraf0bb382016-03-04 15:11:55 +1100601 regress/unittests/kex/test_kex$(EXEEXT) \
Damien Miller6ee4f1c2016-08-23 16:33:48 +1000602 regress/unittests/match/test_match$(EXEEXT) \
603 regress/unittests/utf8/test_utf8$(EXEEXT) \
Damien Milleraf0bb382016-03-04 15:11:55 +1100604 regress/misc/kexfuzz/kexfuzz$(EXEEXT)
Damien Millere7429f22014-05-15 18:01:01 +1000605
Darren Tucker159e9872019-07-24 14:21:19 +1000606tests: file-tests t-exec interop-tests unit
Darren Tuckere93ffd12019-07-29 16:04:01 +1000607 echo all tests passed
Darren Tuckere0055af2019-07-23 23:06:22 +1000608
Darren Tucker159e9872019-07-24 14:21:19 +1000609unit: regress-unit-binaries
610 BUILDDIR=`pwd`; \
611 cd $(srcdir)/regress || exit $$?; \
612 $(MAKE) \
613 .OBJDIR="$${BUILDDIR}/regress" \
614 .CURDIR="`pwd`" \
Darren Tuckere93ffd12019-07-29 16:04:01 +1000615 $@ && echo $@ tests passed
Darren Tucker159e9872019-07-24 14:21:19 +1000616
617interop-tests t-exec file-tests: regress-prep regress-binaries $(TARGETS)
Darren Tucker150a81c2003-09-04 13:41:06 +1000618 BUILDDIR=`pwd`; \
Damien Millerb0e0f762014-01-24 14:27:04 +1100619 TEST_SSH_SCP="$${BUILDDIR}/scp"; \
Darren Tucker150a81c2003-09-04 13:41:06 +1000620 TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
621 TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
622 TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
623 TEST_SSH_SSHADD="$${BUILDDIR}/ssh-add"; \
624 TEST_SSH_SSHKEYGEN="$${BUILDDIR}/ssh-keygen"; \
Damien Miller7ea845e2010-02-12 09:21:02 +1100625 TEST_SSH_SSHPKCS11HELPER="$${BUILDDIR}/ssh-pkcs11-helper"; \
djm@openbsd.org07da39f2019-10-31 21:22:01 +0000626 TEST_SSH_SSHSKHELPER="$${BUILDDIR}/ssh-sk-helper"; \
Darren Tucker150a81c2003-09-04 13:41:06 +1000627 TEST_SSH_SSHKEYSCAN="$${BUILDDIR}/ssh-keyscan"; \
628 TEST_SSH_SFTP="$${BUILDDIR}/sftp"; \
629 TEST_SSH_SFTPSERVER="$${BUILDDIR}/sftp-server"; \
Damien Millerc2cefb02008-03-13 12:41:31 +1100630 TEST_SSH_PLINK="plink"; \
631 TEST_SSH_PUTTYGEN="puttygen"; \
Damien Miller42743cb2008-07-05 09:50:23 +1000632 TEST_SSH_CONCH="conch"; \
Darren Tucker5d376902008-06-11 04:15:05 +1000633 TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \
Darren Tucker47b8c992016-12-08 15:48:34 +1100634 TEST_SSH_UTF8="@TEST_SSH_UTF8@" ; \
Tim Ricecce927c2011-01-12 19:06:31 -0800635 TEST_SSH_ECC="@TEST_SSH_ECC@" ; \
Darren Tucker150a81c2003-09-04 13:41:06 +1000636 cd $(srcdir)/regress || exit $$?; \
637 $(MAKE) \
638 .OBJDIR="$${BUILDDIR}/regress" \
639 .CURDIR="`pwd`" \
Darren Tucker11857652003-09-04 18:04:16 +1000640 BUILDDIR="$${BUILDDIR}" \
Darren Tucker575fac32018-04-13 13:13:33 +1000641 OBJ="$${BUILDDIR}/regress/" \
Darren Tucker150a81c2003-09-04 13:41:06 +1000642 PATH="$${BUILDDIR}:$${PATH}" \
Darren Tucker882abfd2013-11-09 00:17:41 +1100643 TEST_ENV=MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
Darren Tucker732b4632016-03-14 16:04:23 +1100644 TEST_MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
Damien Millerb0e0f762014-01-24 14:27:04 +1100645 TEST_SSH_SCP="$${TEST_SSH_SCP}" \
Darren Tucker150a81c2003-09-04 13:41:06 +1000646 TEST_SSH_SSH="$${TEST_SSH_SSH}" \
647 TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
648 TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
649 TEST_SSH_SSHADD="$${TEST_SSH_SSHADD}" \
650 TEST_SSH_SSHKEYGEN="$${TEST_SSH_SSHKEYGEN}" \
Damien Miller7ea845e2010-02-12 09:21:02 +1100651 TEST_SSH_SSHPKCS11HELPER="$${TEST_SSH_SSHPKCS11HELPER}" \
Darren Tucker150a81c2003-09-04 13:41:06 +1000652 TEST_SSH_SSHKEYSCAN="$${TEST_SSH_SSHKEYSCAN}" \
653 TEST_SSH_SFTP="$${TEST_SSH_SFTP}" \
654 TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
Damien Millerc2cefb02008-03-13 12:41:31 +1100655 TEST_SSH_PLINK="$${TEST_SSH_PLINK}" \
656 TEST_SSH_PUTTYGEN="$${TEST_SSH_PUTTYGEN}" \
Damien Miller42743cb2008-07-05 09:50:23 +1000657 TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \
Tim Ricecce927c2011-01-12 19:06:31 -0800658 TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \
Darren Tucker47b8c992016-12-08 15:48:34 +1100659 TEST_SSH_UTF8="$${TEST_SSH_UTF8}" \
Tim Ricecce927c2011-01-12 19:06:31 -0800660 TEST_SSH_ECC="$${TEST_SSH_ECC}" \
Damien Miller41c8de22014-08-30 16:23:06 +1000661 TEST_SHELL="${TEST_SHELL}" \
Darren Tucker77d07e92003-09-04 22:06:16 +1000662 EXEEXT="$(EXEEXT)" \
Darren Tuckere93ffd12019-07-29 16:04:01 +1000663 $@ && echo all $@ passed
Darren Tucker782390e2003-09-22 10:58:55 +1000664
Darren Tucker4881c372006-02-19 22:50:20 +1100665compat-tests: $(LIBCOMPAT)
666 (cd openbsd-compat/regress && $(MAKE))
667
Darren Tucker782390e2003-09-22 10:58:55 +1000668regressclean:
Darren Tucker25a12342004-08-30 21:33:02 +1000669 if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \
Darren Tucker782390e2003-09-22 10:58:55 +1000670 (cd regress && $(MAKE) clean) \
671 fi
Tim Rice6f1f7582004-05-30 21:38:51 -0700672
Darren Tucker72c025d2005-01-18 12:05:18 +1100673survey: survey.sh ssh
674 @$(SHELL) ./survey.sh > survey
675 @echo 'The survey results have been placed in the file "survey" in the'
676 @echo 'current directory. Please review the file then send with'
677 @echo '"make send-survey".'
678
679send-survey: survey
680 mail portable-survey@mindrot.org <survey
681
Damien Millerf22019b2011-05-05 13:48:37 +1000682package: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
Tim Rice6f1f7582004-05-30 21:38:51 -0700683 if [ "@MAKE_PACKAGE_SUPPORTED@" = yes ]; then \
684 sh buildpkg.sh; \
685 fi
Darren Tucker79c0e1d2017-12-11 14:38:33 +1100686
687# @DEPEND@