1264377Sdes# $Id: Makefile.in,v 1.356 2014/02/04 00:12:56 djm Exp $
298937Sdes
398937Sdes# uncomment if you run a non bourne compatable shell. Ie. csh
498937Sdes#SHELL = @SH@
598937Sdes
698937SdesAUTORECONF=autoreconf
798937Sdes
898937Sdesprefix=@prefix@
998937Sdesexec_prefix=@exec_prefix@
1098937Sdesbindir=@bindir@
1198937Sdessbindir=@sbindir@
1298937Sdeslibexecdir=@libexecdir@
1398937Sdesdatadir=@datadir@
14164146Sdesdatarootdir=@datarootdir@
1598937Sdesmandir=@mandir@
1698937Sdesmansubdir=@mansubdir@
1798937Sdessysconfdir=@sysconfdir@
1898937Sdespiddir=@piddir@
1998937Sdessrcdir=@srcdir@
2098937Sdestop_srcdir=@top_srcdir@
2198937Sdes
2298937SdesDESTDIR=
2398937SdesVPATH=@srcdir@
2498937SdesSSH_PROGRAM=@bindir@/ssh
2598937SdesASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
2698937SdesSFTP_SERVER=$(libexecdir)/sftp-server
2798937SdesSSH_KEYSIGN=$(libexecdir)/ssh-keysign
28204861SdesSSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
2998937SdesPRIVSEP_PATH=@PRIVSEP_PATH@
3099060SdesSSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
31113908SdesSTRIP_OPT=@STRIP_OPT@
3298937Sdes
3398937SdesPATHS= -DSSHDIR=\"$(sysconfdir)\" \
3498937Sdes	-D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
3598937Sdes	-D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \
3698937Sdes	-D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \
3798937Sdes	-D_PATH_SSH_KEY_SIGN=\"$(SSH_KEYSIGN)\" \
38204861Sdes	-D_PATH_SSH_PKCS11_HELPER=\"$(SSH_PKCS11_HELPER)\" \
3998937Sdes	-D_PATH_SSH_PIDDIR=\"$(piddir)\" \
40248613Sdes	-D_PATH_PRIVSEP_CHROOT_DIR=\"$(PRIVSEP_PATH)\"
4198937Sdes
4298937SdesCC=@CC@
4398937SdesLD=@LD@
4498937SdesCFLAGS=@CFLAGS@
4598937SdesCPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
4698937SdesLIBS=@LIBS@
47248613SdesK5LIBS=@K5LIBS@
48248613SdesGSSLIBS=@GSSLIBS@
49218769SdesSSHLIBS=@SSHLIBS@
50162852SdesSSHDLIBS=@SSHDLIBS@
51146998SdesLIBEDIT=@LIBEDIT@
5298937SdesAR=@AR@
53124208SdesAWK=@AWK@
5498937SdesRANLIB=@RANLIB@
5598937SdesINSTALL=@INSTALL@
5698937SdesPERL=@PERL@
57113908SdesSED=@SED@
5898937SdesENT=@ENT@
5998937SdesXAUTH_PATH=@XAUTH_PATH@
6098937SdesLDFLAGS=-L. -Lopenbsd-compat/ @LDFLAGS@
6198937SdesEXEEXT=@EXEEXT@
62218767SdesMANFMT=@MANFMT@
6398937Sdes
64225825SdesTARGETS=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)
6598937Sdes
66248613SdesLIBSSH_OBJS=authfd.o authfile.o bufaux.o bufbn.o buffer.o \
67248613Sdes	canohost.o channels.o cipher.o cipher-aes.o \
68126274Sdes	cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
69126274Sdes	compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
70162852Sdes	log.o match.o md-sha256.o moduli.o nchan.o packet.o \
71180750Sdes	readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
72137015Sdes	atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
73218767Sdes	monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
74218767Sdes	kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
75248613Sdes	msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \
76264377Sdes	ssh-pkcs11.o krl.o smult_curve25519_ref.o \
77262566Sdes	kexc25519.o kexc25519c.o poly1305.o chacha.o cipher-chachapoly.o \
78264377Sdes	ssh-ed25519.o digest-openssl.o hmac.o \
79262566Sdes	sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o
8098937Sdes
81113908SdesSSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
82197670Sdes	sshconnect.o sshconnect1.o sshconnect2.o mux.o \
83204861Sdes	roaming_common.o roaming_client.o
8498937Sdes
85113908SdesSSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
86218767Sdes	audit.o audit-bsm.o audit-linux.o platform.o \
87137015Sdes	sshpty.o sshlogin.o servconf.o serverloop.o \
88113908Sdes	auth.o auth1.o auth2.o auth-options.o session.o \
89113908Sdes	auth-chall.o auth2-chall.o groupaccess.o \
90113908Sdes	auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
91264377Sdes	auth2-none.o auth2-passwd.o auth2-pubkey.o \
92218767Sdes	monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o kexecdhs.o \
93262566Sdes	kexc25519s.o auth-krb5.o \
94124208Sdes	auth2-gss.o gss-serv.o gss-serv-krb5.o \
95146998Sdes	loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
96218767Sdes	sftp-server.o sftp-common.o \
97225825Sdes	roaming_common.o roaming_serv.o \
98239844Sdes	sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \
99262566Sdes	sandbox-seccomp-filter.o sandbox-capsicum.o
10098937Sdes
101225825SdesMANPAGES	= 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
102225825SdesMANPAGES_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
10398937SdesMANTYPE		= @MANTYPE@
10498937Sdes
10598937SdesCONFIGFILES=sshd_config.out ssh_config.out moduli.out
10698937SdesCONFIGFILES_IN=sshd_config ssh_config moduli
10798937Sdes
10898937SdesPATHSUBS	= \
109113908Sdes	-e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \
110113908Sdes	-e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \
111113908Sdes	-e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
112113908Sdes	-e 's|/usr/libexec|$(libexecdir)|g' \
113113908Sdes	-e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
114113908Sdes	-e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
115218767Sdes	-e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \
116113908Sdes	-e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
117113908Sdes	-e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
118262566Sdes	-e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \
119113908Sdes	-e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
120180750Sdes	-e 's|/etc/moduli|$(sysconfdir)/moduli|g' \
121113908Sdes	-e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
122162852Sdes	-e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \
123113908Sdes	-e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \
124113908Sdes	-e 's|/var/empty|$(PRIVSEP_PATH)|g' \
125113908Sdes	-e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g'
12698937Sdes
127113908SdesFIXPATHSCMD	= $(SED) $(PATHSUBS)
128255670SdesFIXALGORITHMSCMD= $(SHELL) $(srcdir)/fixalgorithms $(SED) \
129255670Sdes		     @UNSUPPORTED_ALGORITHMS@
13098937Sdes
131225825Sdesall: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
13298937Sdes
133124208Sdes$(LIBSSH_OBJS): Makefile.in config.h
134124208Sdes$(SSHOBJS): Makefile.in config.h
135124208Sdes$(SSHDOBJS): Makefile.in config.h
13698937Sdes
13798937Sdes.c.o:
13898937Sdes	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
13998937Sdes
14098937SdesLIBCOMPAT=openbsd-compat/libopenbsd-compat.a
14198937Sdes$(LIBCOMPAT): always
14298937Sdes	(cd openbsd-compat && $(MAKE))
14398937Sdesalways:
14498937Sdes
14598937Sdeslibssh.a: $(LIBSSH_OBJS)
14698937Sdes	$(AR) rv $@ $(LIBSSH_OBJS)
14798937Sdes	$(RANLIB) $@
14898937Sdes
14998937Sdesssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
150248613Sdes	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS) $(GSSLIBS)
15198937Sdes
15298937Sdessshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
153248613Sdes	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS)
15498937Sdes
155113908Sdesscp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
156157016Sdes	$(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
15798937Sdes
15898937Sdesssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
159126274Sdes	$(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
16098937Sdes
161204861Sdesssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o
162204861Sdes	$(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
16398937Sdes
16498937Sdesssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
165126274Sdes	$(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
16698937Sdes
167204861Sdesssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o roaming_dummy.o readconf.o
168197670Sdes	$(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
16998937Sdes
170204861Sdesssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o
171214979Sdes	$(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
172204861Sdes
173197670Sdesssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o
174197670Sdes	$(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
17598937Sdes
176180746Sdessftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o
177180746Sdes	$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
17898937Sdes
179126274Sdessftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o
180146998Sdes	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
18198937Sdes
18298937Sdes# test driver for the loginrec code - not built by default
18398937Sdeslogintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
18498937Sdes	$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
18598937Sdes
18698937Sdes$(MANPAGES): $(MANPAGES_IN)
18798937Sdes	if test "$(MANTYPE)" = "cat"; then \
18898937Sdes		manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
18998937Sdes	else \
19098937Sdes		manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
19198937Sdes	fi; \
19298937Sdes	if test "$(MANTYPE)" = "man"; then \
193255670Sdes		$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) | \
194255670Sdes		    $(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
19598937Sdes	else \
196255670Sdes		$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) > $@; \
19798937Sdes	fi
19898937Sdes
19998937Sdes$(CONFIGFILES): $(CONFIGFILES_IN)
20098937Sdes	conffile=`echo $@ | sed 's/.out$$//'`; \
20198937Sdes	$(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
20298937Sdes
203149749Sdes# fake rule to stop make trying to compile moduli.o into a binary "moduli.o"
204124208Sdesmoduli:
205124208Sdes	echo
206124208Sdes
207248613Sdes# special case target for umac128
208248613Sdesumac128.o:	umac.c
209248613Sdes	$(CC) $(CFLAGS) $(CPPFLAGS) -o umac128.o -c $(srcdir)/umac.c \
210248613Sdes	    -DUMAC_OUTPUT_LEN=16 -Dumac_new=umac128_new \
211248613Sdes	    -Dumac_update=umac128_update -Dumac_final=umac128_final \
212248613Sdes	    -Dumac_delete=umac128_delete
213248613Sdes
214124208Sdesclean:	regressclean
215126274Sdes	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
216146998Sdes	rm -f *.out core survey
21798937Sdes	(cd openbsd-compat && $(MAKE) clean)
21898937Sdes
219124208Sdesdistclean:	regressclean
220126274Sdes	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
221162852Sdes	rm -f *.out core opensshd.init openssh.xml
222225825Sdes	rm -f Makefile buildpkg.sh config.h config.status
223162852Sdes	rm -f survey.sh openbsd-compat/regress/Makefile *~ 
22498937Sdes	rm -rf autom4te.cache
22598937Sdes	(cd openbsd-compat && $(MAKE) distclean)
226137015Sdes	if test -d pkg ; then \
227137015Sdes		rm -fr pkg ; \
228137015Sdes	fi
22998937Sdes
230124208Sdesveryclean: distclean
23198937Sdes	rm -f configure config.h.in *.0
23298937Sdes
233225825Sdescleandir: veryclean
234225825Sdes
235124208Sdesmrproper: veryclean
23698937Sdes
237124208Sdesrealclean: veryclean
238124208Sdes
23998937Sdescatman-do:
24098937Sdes	@for f in $(MANPAGES_IN) ; do \
24198937Sdes		base=`echo $$f | sed 's/\..*$$//'` ; \
24298937Sdes		echo "$$f -> $$base.0" ; \
243218767Sdes		$(MANFMT) $$f | cat -v | sed -e 's/.\^H//g' \
24498937Sdes			>$$base.0 ; \
24598937Sdes	done
24698937Sdes
24798937Sdesdistprep: catman-do
24898937Sdes	$(AUTORECONF)
249126274Sdes	-rm -rf autom4te.cache
25098937Sdes
251225825Sdesinstall: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
252225825Sdesinstall-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf
253225825Sdesinstall-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
25498937Sdes
255106121Sdescheck-config:
256106121Sdes	-$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
25799060Sdes
258204861Sdesinstall-files:
25998937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
26098937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
26198937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
26298937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
26398937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)5
26498937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
26598937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
266106121Sdes	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
267207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT)
268207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT)
269207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
270207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
271207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
272207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
273207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
274207311Sdes	$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
275207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
276207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
277207311Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
27898937Sdes	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
27998937Sdes	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
28098937Sdes	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
28198937Sdes	$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
28298937Sdes	$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
28398937Sdes	$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
284180750Sdes	$(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5
28598937Sdes	$(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
28698937Sdes	$(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
28798937Sdes	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
288113908Sdes	$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
289113908Sdes	$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
29098937Sdes	$(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
291204861Sdes	$(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
29298937Sdes	-rm -f $(DESTDIR)$(bindir)/slogin
293106121Sdes	ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
29498937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
295106121Sdes	ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
296146998Sdes
297146998Sdesinstall-sysconf:
29898937Sdes	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
29998937Sdes		$(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
30098937Sdes	fi
301106121Sdes	@if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
30298937Sdes		$(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
30398937Sdes	else \
30498937Sdes		echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
30598937Sdes	fi
306106121Sdes	@if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
30798937Sdes		$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
30898937Sdes	else \
30998937Sdes		echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
31098937Sdes	fi
311106121Sdes	@if [ ! -f $(DESTDIR)$(sysconfdir)/moduli ]; then \
31298937Sdes		if [ -f $(DESTDIR)$(sysconfdir)/primes ]; then \
31398937Sdes			echo "moving $(DESTDIR)$(sysconfdir)/primes to $(DESTDIR)$(sysconfdir)/moduli"; \
31498937Sdes			mv "$(DESTDIR)$(sysconfdir)/primes" "$(DESTDIR)$(sysconfdir)/moduli"; \
31598937Sdes		else \
31698937Sdes			$(INSTALL) -m 644 moduli.out $(DESTDIR)$(sysconfdir)/moduli; \
31798937Sdes		fi ; \
31898937Sdes	else \
31998937Sdes		echo "$(DESTDIR)$(sysconfdir)/moduli already exists, install will not overwrite"; \
32098937Sdes	fi
32198937Sdes
32298937Sdeshost-key: ssh-keygen$(EXEEXT)
323106121Sdes	@if [ -z "$(DESTDIR)" ] ; then \
324218767Sdes		if [ -f "$(sysconfdir)/ssh_host_key" ] ; then \
325218767Sdes			echo "$(sysconfdir)/ssh_host_key already exists, skipping." ; \
32698937Sdes		else \
327218767Sdes			./ssh-keygen -t rsa1 -f $(sysconfdir)/ssh_host_key -N "" ; \
32898937Sdes		fi ; \
329218767Sdes		if [ -f $(sysconfdir)/ssh_host_dsa_key ] ; then \
330218767Sdes			echo "$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \
33198937Sdes		else \
332218767Sdes			./ssh-keygen -t dsa -f $(sysconfdir)/ssh_host_dsa_key -N "" ; \
33398937Sdes		fi ; \
334218767Sdes		if [ -f $(sysconfdir)/ssh_host_rsa_key ] ; then \
335218767Sdes			echo "$(sysconfdir)/ssh_host_rsa_key already exists, skipping." ; \
33698937Sdes		else \
337218767Sdes			./ssh-keygen -t rsa -f $(sysconfdir)/ssh_host_rsa_key -N "" ; \
33898937Sdes		fi ; \
339262566Sdes		if [ -f $(sysconfdir)/ssh_host_ed25519_key ] ; then \
340262566Sdes			echo "$(sysconfdir)/ssh_host_ed25519_key already exists, skipping." ; \
341262566Sdes		else \
342262566Sdes			./ssh-keygen -t ed25519 -f $(sysconfdir)/ssh_host_ed25519_key -N "" ; \
343262566Sdes		fi ; \
344218767Sdes		if [ -z "@COMMENT_OUT_ECC@" ] ; then \
345218767Sdes		    if [ -f $(sysconfdir)/ssh_host_ecdsa_key ] ; then \
346218767Sdes			echo "$(sysconfdir)/ssh_host_ecdsa_key already exists, skipping." ; \
347218767Sdes		    else \
348218767Sdes			./ssh-keygen -t ecdsa -f $(sysconfdir)/ssh_host_ecdsa_key -N "" ; \
349218767Sdes		    fi ; \
350218767Sdes		fi ; \
35198937Sdes	fi ;
35298937Sdes
35398937Sdeshost-key-force: ssh-keygen$(EXEEXT)
35498937Sdes	./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N ""
35598937Sdes	./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
35698937Sdes	./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
357262566Sdes	./ssh-keygen -t ed25519 -f $(DESTDIR)$(sysconfdir)/ssh_host_ed25519_key -N ""
358218767Sdes	test -z "@COMMENT_OUT_ECC@" && ./ssh-keygen -t ecdsa -f $(DESTDIR)$(sysconfdir)/ssh_host_ecdsa_key -N ""
35998937Sdes
36098937Sdesuninstallall:	uninstall
36198937Sdes	-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
36298937Sdes	-rm -f $(DESTDIR)$(sysconfdir)/sshd_config
36398937Sdes	-rmdir $(DESTDIR)$(sysconfdir)
36498937Sdes	-rmdir $(DESTDIR)$(bindir)
36598937Sdes	-rmdir $(DESTDIR)$(sbindir)
36698937Sdes	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
36798937Sdes	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
36898937Sdes	-rmdir $(DESTDIR)$(mandir)
36998937Sdes	-rmdir $(DESTDIR)$(libexecdir)
37098937Sdes
371126274Sdesuninstall:
37298937Sdes	-rm -f $(DESTDIR)$(bindir)/slogin
37398937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
37498937Sdes	-rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
37598937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
37698937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
37798937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
37898937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
37998937Sdes	-rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
38098937Sdes	-rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
38198937Sdes	-rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
38298937Sdes	-rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
383204861Sdes	-rm -f $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
38498937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
38598937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
38698937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
38798937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
38898937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
38998937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
39098937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
39198937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
39298937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
39398937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
394204861Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
39598937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
396124208Sdes
397248613Sdesregress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
398255670Sdes	[ -d `pwd`/regress ]  ||  mkdir -p `pwd`/regress
399255670Sdes	[ -f `pwd`/regress/Makefile ]  || \
400255670Sdes	    ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
401255670Sdes	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
402255670Sdes	$(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
403248613Sdes
404262566Sdesregress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
405262566Sdes	[ -d `pwd`/regress ]  ||  mkdir -p `pwd`/regress
406262566Sdes	[ -f `pwd`/regress/Makefile ]  || \
407262566Sdes	    ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
408262566Sdes	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
409262566Sdes	$(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
410262566Sdes
411264377Sdestests interop-tests:	$(TARGETS) regress/modpipe$(EXEEXT) regress/setuid-allowed$(EXEEXT)
412124208Sdes	BUILDDIR=`pwd`; \
413137015Sdes	TEST_SHELL="@TEST_SHELL@"; \
414262566Sdes	TEST_SSH_SCP="$${BUILDDIR}/scp"; \
415124208Sdes	TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
416124208Sdes	TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
417124208Sdes	TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
418124208Sdes	TEST_SSH_SSHADD="$${BUILDDIR}/ssh-add"; \
419124208Sdes	TEST_SSH_SSHKEYGEN="$${BUILDDIR}/ssh-keygen"; \
420204861Sdes	TEST_SSH_SSHPKCS11HELPER="$${BUILDDIR}/ssh-pkcs11-helper"; \
421124208Sdes	TEST_SSH_SSHKEYSCAN="$${BUILDDIR}/ssh-keyscan"; \
422124208Sdes	TEST_SSH_SFTP="$${BUILDDIR}/sftp"; \
423124208Sdes	TEST_SSH_SFTPSERVER="$${BUILDDIR}/sftp-server"; \
424180746Sdes	TEST_SSH_PLINK="plink"; \
425180746Sdes	TEST_SSH_PUTTYGEN="puttygen"; \
426180750Sdes	TEST_SSH_CONCH="conch"; \
427180750Sdes	TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \
428218767Sdes	TEST_SSH_ECC="@TEST_SSH_ECC@" ; \
429124208Sdes	cd $(srcdir)/regress || exit $$?; \
430124208Sdes	$(MAKE) \
431124208Sdes		.OBJDIR="$${BUILDDIR}/regress" \
432124208Sdes		.CURDIR="`pwd`" \
433124208Sdes		BUILDDIR="$${BUILDDIR}" \
434124208Sdes		OBJ="$${BUILDDIR}/regress/" \
435124208Sdes		PATH="$${BUILDDIR}:$${PATH}" \
436262566Sdes		TEST_ENV=MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
437126274Sdes		TEST_SHELL="$${TEST_SHELL}" \
438262566Sdes		TEST_SSH_SCP="$${TEST_SSH_SCP}" \
439124208Sdes		TEST_SSH_SSH="$${TEST_SSH_SSH}" \
440124208Sdes		TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
441124208Sdes		TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
442124208Sdes		TEST_SSH_SSHADD="$${TEST_SSH_SSHADD}" \
443124208Sdes		TEST_SSH_SSHKEYGEN="$${TEST_SSH_SSHKEYGEN}" \
444204861Sdes		TEST_SSH_SSHPKCS11HELPER="$${TEST_SSH_SSHPKCS11HELPER}" \
445124208Sdes		TEST_SSH_SSHKEYSCAN="$${TEST_SSH_SSHKEYSCAN}" \
446124208Sdes		TEST_SSH_SFTP="$${TEST_SSH_SFTP}" \
447124208Sdes		TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
448180746Sdes		TEST_SSH_PLINK="$${TEST_SSH_PLINK}" \
449180746Sdes		TEST_SSH_PUTTYGEN="$${TEST_SSH_PUTTYGEN}" \
450180750Sdes		TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \
451218767Sdes		TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \
452218767Sdes		TEST_SSH_ECC="$${TEST_SSH_ECC}" \
453124208Sdes		EXEEXT="$(EXEEXT)" \
454180750Sdes		$@ && echo all tests passed
455124208Sdes
456162852Sdescompat-tests: $(LIBCOMPAT)
457162852Sdes	(cd openbsd-compat/regress && $(MAKE))
458162852Sdes
459124208Sdesregressclean:
460146998Sdes	if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \
461124208Sdes		(cd regress && $(MAKE) clean) \
462124208Sdes	fi
463137015Sdes
464146998Sdessurvey: survey.sh ssh
465146998Sdes	@$(SHELL) ./survey.sh > survey
466146998Sdes	@echo 'The survey results have been placed in the file "survey" in the'
467146998Sdes	@echo 'current directory.  Please review the file then send with'
468146998Sdes	@echo '"make send-survey".'
469146998Sdes
470146998Sdessend-survey:	survey
471146998Sdes	mail portable-survey@mindrot.org <survey
472146998Sdes
473225825Sdespackage: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
474137015Sdes	if [ "@MAKE_PACKAGE_SUPPORTED@" = yes ]; then \
475137015Sdes		sh buildpkg.sh; \
476137015Sdes	fi
477