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