1# $Id: Makefile.in,v 1.325 2011/08/05 20:15:18 djm Exp $
2
3# uncomment if you run a non bourne compatable shell. Ie. csh
4#SHELL = @SH@
5
6AUTORECONF=autoreconf
7
8prefix=@prefix@
9exec_prefix=@exec_prefix@
10bindir=@bindir@
11sbindir=@sbindir@
12libexecdir=@libexecdir@
13datadir=@datadir@
14datarootdir=@datarootdir@
15mandir=@mandir@
16mansubdir=@mansubdir@
17sysconfdir=@sysconfdir@
18piddir=@piddir@
19srcdir=@srcdir@
20top_srcdir=@top_srcdir@
21
22DESTDIR=
23VPATH=@srcdir@
24SSH_PROGRAM=@bindir@/ssh
25ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
26SFTP_SERVER=$(libexecdir)/sftp-server
27SSH_KEYSIGN=$(libexecdir)/ssh-keysign
28SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
29PRIVSEP_PATH=@PRIVSEP_PATH@
30SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
31STRIP_OPT=@STRIP_OPT@
32
33PATHS= -DSSHDIR=\"$(sysconfdir)\" \
34	-D_PATH_SSH_PROGRAM=\"$(SSH_PROGRAM)\" \
35	-D_PATH_SSH_ASKPASS_DEFAULT=\"$(ASKPASS_PROGRAM)\" \
36	-D_PATH_SFTP_SERVER=\"$(SFTP_SERVER)\" \
37	-D_PATH_SSH_KEY_SIGN=\"$(SSH_KEYSIGN)\" \
38	-D_PATH_SSH_PKCS11_HELPER=\"$(SSH_PKCS11_HELPER)\" \
39	-D_PATH_SSH_PIDDIR=\"$(piddir)\" \
40	-D_PATH_PRIVSEP_CHROOT_DIR=\"$(PRIVSEP_PATH)\" \
41
42CC=@CC@
43LD=@LD@
44CFLAGS=@CFLAGS@
45CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
46LIBS=@LIBS@
47SSHLIBS=@SSHLIBS@
48SSHDLIBS=@SSHDLIBS@
49LIBEDIT=@LIBEDIT@
50AR=@AR@
51AWK=@AWK@
52RANLIB=@RANLIB@
53INSTALL=@INSTALL@
54PERL=@PERL@
55SED=@SED@
56ENT=@ENT@
57XAUTH_PATH=@XAUTH_PATH@
58LDFLAGS=-L. -Lopenbsd-compat/ @LDFLAGS@
59EXEEXT=@EXEEXT@
60MANFMT=@MANFMT@
61
62TARGETS=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)
63
64LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o bufbn.o buffer.o \
65	canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \
66	cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
67	compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
68	log.o match.o md-sha256.o moduli.o nchan.o packet.o \
69	readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
70	atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
71	monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
72	kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
73	msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o jpake.o \
74	schnorr.o ssh-pkcs11.o
75
76SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
77	sshconnect.o sshconnect1.o sshconnect2.o mux.o \
78	roaming_common.o roaming_client.o
79
80SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
81	audit.o audit-bsm.o audit-linux.o platform.o \
82	sshpty.o sshlogin.o servconf.o serverloop.o \
83	auth.o auth1.o auth2.o auth-options.o session.o \
84	auth-chall.o auth2-chall.o groupaccess.o \
85	auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
86	auth2-none.o auth2-passwd.o auth2-pubkey.o auth2-jpake.o \
87	monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o kexecdhs.o \
88	auth-krb5.o \
89	auth2-gss.o gss-serv.o gss-serv-krb5.o \
90	loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
91	sftp-server.o sftp-common.o \
92	roaming_common.o roaming_serv.o \
93	sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o
94
95MANPAGES	= 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
96MANPAGES_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
97MANTYPE		= @MANTYPE@
98
99CONFIGFILES=sshd_config.out ssh_config.out moduli.out
100CONFIGFILES_IN=sshd_config ssh_config moduli
101
102PATHSUBS	= \
103	-e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \
104	-e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \
105	-e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
106	-e 's|/usr/libexec|$(libexecdir)|g' \
107	-e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
108	-e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
109	-e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \
110	-e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
111	-e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
112	-e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
113	-e 's|/etc/moduli|$(sysconfdir)/moduli|g' \
114	-e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
115	-e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \
116	-e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \
117	-e 's|/var/empty|$(PRIVSEP_PATH)|g' \
118	-e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g'
119
120FIXPATHSCMD	= $(SED) $(PATHSUBS)
121
122all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
123
124$(LIBSSH_OBJS): Makefile.in config.h
125$(SSHOBJS): Makefile.in config.h
126$(SSHDOBJS): Makefile.in config.h
127
128.c.o:
129	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
130
131LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
132$(LIBCOMPAT): always
133	(cd openbsd-compat && $(MAKE))
134always:
135
136libssh.a: $(LIBSSH_OBJS)
137	$(AR) rv $@ $(LIBSSH_OBJS)
138	$(RANLIB) $@
139
140ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
141	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS)
142
143sshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
144	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS)
145
146scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
147	$(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
148
149ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
150	$(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
151
152ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o
153	$(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
154
155ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
156	$(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
157
158ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o roaming_dummy.o readconf.o
159	$(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
160
161ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o
162	$(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
163
164ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o
165	$(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
166
167sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o
168	$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
169
170sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o
171	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
172
173# test driver for the loginrec code - not built by default
174logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
175	$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
176
177$(MANPAGES): $(MANPAGES_IN)
178	if test "$(MANTYPE)" = "cat"; then \
179		manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
180	else \
181		manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
182	fi; \
183	if test "$(MANTYPE)" = "man"; then \
184		$(FIXPATHSCMD) $${manpage} | $(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
185	else \
186		$(FIXPATHSCMD) $${manpage} > $@; \
187	fi
188
189$(CONFIGFILES): $(CONFIGFILES_IN)
190	conffile=`echo $@ | sed 's/.out$$//'`; \
191	$(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
192
193# fake rule to stop make trying to compile moduli.o into a binary "moduli.o"
194moduli:
195	echo
196
197clean:	regressclean
198	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
199	rm -f *.out core survey
200	(cd openbsd-compat && $(MAKE) clean)
201
202distclean:	regressclean
203	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
204	rm -f *.out core opensshd.init openssh.xml
205	rm -f Makefile buildpkg.sh config.h config.status
206	rm -f survey.sh openbsd-compat/regress/Makefile *~ 
207	rm -rf autom4te.cache
208	(cd openbsd-compat && $(MAKE) distclean)
209	if test -d pkg ; then \
210		rm -fr pkg ; \
211	fi
212
213veryclean: distclean
214	rm -f configure config.h.in *.0
215
216cleandir: veryclean
217
218mrproper: veryclean
219
220realclean: veryclean
221
222catman-do:
223	@for f in $(MANPAGES_IN) ; do \
224		base=`echo $$f | sed 's/\..*$$//'` ; \
225		echo "$$f -> $$base.0" ; \
226		$(MANFMT) $$f | cat -v | sed -e 's/.\^H//g' \
227			>$$base.0 ; \
228	done
229
230distprep: catman-do
231	$(AUTORECONF)
232	-rm -rf autom4te.cache
233
234install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
235install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf
236install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
237
238check-config:
239	-$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
240
241install-files:
242	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
243	$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
244	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
245	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
246	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)5
247	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
248	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
249	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
250	$(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT)
251	$(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT)
252	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
253	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
254	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
255	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
256	$(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
257	$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
258	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
259	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
260	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
261	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
262	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
263	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
264	$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
265	$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
266	$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
267	$(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5
268	$(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
269	$(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
270	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
271	$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
272	$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
273	$(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
274	$(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
275	-rm -f $(DESTDIR)$(bindir)/slogin
276	ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
277	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
278	ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
279
280install-sysconf:
281	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
282		$(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
283	fi
284	@if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
285		$(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
286	else \
287		echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
288	fi
289	@if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
290		$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
291	else \
292		echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
293	fi
294	@if [ ! -f $(DESTDIR)$(sysconfdir)/moduli ]; then \
295		if [ -f $(DESTDIR)$(sysconfdir)/primes ]; then \
296			echo "moving $(DESTDIR)$(sysconfdir)/primes to $(DESTDIR)$(sysconfdir)/moduli"; \
297			mv "$(DESTDIR)$(sysconfdir)/primes" "$(DESTDIR)$(sysconfdir)/moduli"; \
298		else \
299			$(INSTALL) -m 644 moduli.out $(DESTDIR)$(sysconfdir)/moduli; \
300		fi ; \
301	else \
302		echo "$(DESTDIR)$(sysconfdir)/moduli already exists, install will not overwrite"; \
303	fi
304
305host-key: ssh-keygen$(EXEEXT)
306	@if [ -z "$(DESTDIR)" ] ; then \
307		if [ -f "$(sysconfdir)/ssh_host_key" ] ; then \
308			echo "$(sysconfdir)/ssh_host_key already exists, skipping." ; \
309		else \
310			./ssh-keygen -t rsa1 -f $(sysconfdir)/ssh_host_key -N "" ; \
311		fi ; \
312		if [ -f $(sysconfdir)/ssh_host_dsa_key ] ; then \
313			echo "$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \
314		else \
315			./ssh-keygen -t dsa -f $(sysconfdir)/ssh_host_dsa_key -N "" ; \
316		fi ; \
317		if [ -f $(sysconfdir)/ssh_host_rsa_key ] ; then \
318			echo "$(sysconfdir)/ssh_host_rsa_key already exists, skipping." ; \
319		else \
320			./ssh-keygen -t rsa -f $(sysconfdir)/ssh_host_rsa_key -N "" ; \
321		fi ; \
322		if [ -z "@COMMENT_OUT_ECC@" ] ; then \
323		    if [ -f $(sysconfdir)/ssh_host_ecdsa_key ] ; then \
324			echo "$(sysconfdir)/ssh_host_ecdsa_key already exists, skipping." ; \
325		    else \
326			./ssh-keygen -t ecdsa -f $(sysconfdir)/ssh_host_ecdsa_key -N "" ; \
327		    fi ; \
328		fi ; \
329	fi ;
330
331host-key-force: ssh-keygen$(EXEEXT)
332	./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N ""
333	./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
334	./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
335	test -z "@COMMENT_OUT_ECC@" && ./ssh-keygen -t ecdsa -f $(DESTDIR)$(sysconfdir)/ssh_host_ecdsa_key -N ""
336
337uninstallall:	uninstall
338	-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
339	-rm -f $(DESTDIR)$(sysconfdir)/sshd_config
340	-rmdir $(DESTDIR)$(sysconfdir)
341	-rmdir $(DESTDIR)$(bindir)
342	-rmdir $(DESTDIR)$(sbindir)
343	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
344	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
345	-rmdir $(DESTDIR)$(mandir)
346	-rmdir $(DESTDIR)$(libexecdir)
347
348uninstall:
349	-rm -f $(DESTDIR)$(bindir)/slogin
350	-rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
351	-rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
352	-rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
353	-rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
354	-rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
355	-rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
356	-rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
357	-rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
358	-rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
359	-rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
360	-rm -f $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
361	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
362	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
363	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
364	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
365	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
366	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
367	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
368	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
369	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
370	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
371	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
372	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
373
374tests interop-tests:	$(TARGETS)
375	BUILDDIR=`pwd`; \
376	[ -d `pwd`/regress ]  ||  mkdir -p `pwd`/regress; \
377	[ -f `pwd`/regress/Makefile ]  || \
378	    ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile ; \
379	TEST_SHELL="@TEST_SHELL@"; \
380	TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
381	TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
382	TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
383	TEST_SSH_SSHADD="$${BUILDDIR}/ssh-add"; \
384	TEST_SSH_SSHKEYGEN="$${BUILDDIR}/ssh-keygen"; \
385	TEST_SSH_SSHPKCS11HELPER="$${BUILDDIR}/ssh-pkcs11-helper"; \
386	TEST_SSH_SSHKEYSCAN="$${BUILDDIR}/ssh-keyscan"; \
387	TEST_SSH_SFTP="$${BUILDDIR}/sftp"; \
388	TEST_SSH_SFTPSERVER="$${BUILDDIR}/sftp-server"; \
389	TEST_SSH_PLINK="plink"; \
390	TEST_SSH_PUTTYGEN="puttygen"; \
391	TEST_SSH_CONCH="conch"; \
392	TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \
393	TEST_SSH_ECC="@TEST_SSH_ECC@" ; \
394	TEST_SSH_SHA256="@TEST_SSH_SHA256@" ; \
395	cd $(srcdir)/regress || exit $$?; \
396	$(MAKE) \
397		.OBJDIR="$${BUILDDIR}/regress" \
398		.CURDIR="`pwd`" \
399		BUILDDIR="$${BUILDDIR}" \
400		OBJ="$${BUILDDIR}/regress/" \
401		PATH="$${BUILDDIR}:$${PATH}" \
402		TEST_SHELL="$${TEST_SHELL}" \
403		TEST_SSH_SSH="$${TEST_SSH_SSH}" \
404		TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
405		TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
406		TEST_SSH_SSHADD="$${TEST_SSH_SSHADD}" \
407		TEST_SSH_SSHKEYGEN="$${TEST_SSH_SSHKEYGEN}" \
408		TEST_SSH_SSHPKCS11HELPER="$${TEST_SSH_SSHPKCS11HELPER}" \
409		TEST_SSH_SSHKEYSCAN="$${TEST_SSH_SSHKEYSCAN}" \
410		TEST_SSH_SFTP="$${TEST_SSH_SFTP}" \
411		TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
412		TEST_SSH_PLINK="$${TEST_SSH_PLINK}" \
413		TEST_SSH_PUTTYGEN="$${TEST_SSH_PUTTYGEN}" \
414		TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \
415		TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \
416		TEST_SSH_ECC="$${TEST_SSH_ECC}" \
417		TEST_SSH_SHA256="$${TEST_SSH_SHA256}" \
418		EXEEXT="$(EXEEXT)" \
419		$@ && echo all tests passed
420
421compat-tests: $(LIBCOMPAT)
422	(cd openbsd-compat/regress && $(MAKE))
423
424regressclean:
425	if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \
426		(cd regress && $(MAKE) clean) \
427	fi
428
429survey: survey.sh ssh
430	@$(SHELL) ./survey.sh > survey
431	@echo 'The survey results have been placed in the file "survey" in the'
432	@echo 'current directory.  Please review the file then send with'
433	@echo '"make send-survey".'
434
435send-survey:	survey
436	mail portable-survey@mindrot.org <survey
437
438package: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
439	if [ "@MAKE_PACKAGE_SUPPORTED@" = yes ]; then \
440		sh buildpkg.sh; \
441	fi
442
443