xref: /freebsd/crypto/openssh/Makefile.in (revision cdc58367265a2bd6e8f913db2bdc591699ee229f)
1# $Id: Makefile.in,v 1.356 2014/02/04 00:12:56 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@
47K5LIBS=@K5LIBS@
48GSSLIBS=@GSSLIBS@
49SSHLIBS=@SSHLIBS@
50SSHDLIBS=@SSHDLIBS@
51LIBEDIT=@LIBEDIT@
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@
62MANFMT=@MANFMT@
63
64TARGETS=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)
65
66LIBSSH_OBJS=authfd.o authfile.o bufaux.o bufbn.o buffer.o \
67	canohost.o channels.o cipher.o cipher-aes.o \
68	cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
69	compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
70	log.o match.o md-sha256.o moduli.o nchan.o packet.o \
71	readpass.o rsa.o ttymodes.o xmalloc.o addrmatch.o \
72	atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
73	monitor_fdpass.o rijndael.o ssh-dss.o ssh-ecdsa.o ssh-rsa.o dh.o \
74	kexdh.o kexgex.o kexdhc.o kexgexc.o bufec.o kexecdh.o kexecdhc.o \
75	msg.o progressmeter.o dns.o entropy.o gss-genr.o umac.o umac128.o \
76	ssh-pkcs11.o krl.o smult_curve25519_ref.o \
77	kexc25519.o kexc25519c.o poly1305.o chacha.o cipher-chachapoly.o \
78	ssh-ed25519.o digest-openssl.o hmac.o \
79	sc25519.o ge25519.o fe25519.o ed25519.o verify.o hash.o blocks.o
80
81SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
82	sshconnect.o sshconnect1.o sshconnect2.o mux.o \
83	roaming_common.o roaming_client.o
84
85SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
86	audit.o audit-bsm.o audit-linux.o platform.o \
87	sshpty.o sshlogin.o servconf.o serverloop.o \
88	auth.o auth1.o auth2.o auth-options.o session.o \
89	auth-chall.o auth2-chall.o groupaccess.o \
90	auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
91	auth2-none.o auth2-passwd.o auth2-pubkey.o \
92	monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o kexecdhs.o \
93	kexc25519s.o auth-krb5.o \
94	auth2-gss.o gss-serv.o gss-serv-krb5.o \
95	loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
96	sftp-server.o sftp-common.o \
97	roaming_common.o roaming_serv.o \
98	sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \
99	sandbox-seccomp-filter.o sandbox-capsicum.o
100
101MANPAGES	= 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
102MANPAGES_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
103MANTYPE		= @MANTYPE@
104
105CONFIGFILES=sshd_config.out ssh_config.out moduli.out
106CONFIGFILES_IN=sshd_config ssh_config moduli
107
108PATHSUBS	= \
109	-e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \
110	-e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \
111	-e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
112	-e 's|/usr/libexec|$(libexecdir)|g' \
113	-e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
114	-e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
115	-e 's|/etc/ssh/ssh_host_ecdsa_key|$(sysconfdir)/ssh_host_ecdsa_key|g' \
116	-e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
117	-e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
118	-e 's|/etc/ssh/ssh_host_ed25519_key|$(sysconfdir)/ssh_host_ed25519_key|g' \
119	-e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
120	-e 's|/etc/moduli|$(sysconfdir)/moduli|g' \
121	-e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
122	-e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \
123	-e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \
124	-e 's|/var/empty|$(PRIVSEP_PATH)|g' \
125	-e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g'
126
127FIXPATHSCMD	= $(SED) $(PATHSUBS)
128FIXALGORITHMSCMD= $(SHELL) $(srcdir)/fixalgorithms $(SED) \
129		     @UNSUPPORTED_ALGORITHMS@
130
131all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
132
133$(LIBSSH_OBJS): Makefile.in config.h
134$(SSHOBJS): Makefile.in config.h
135$(SSHDOBJS): Makefile.in config.h
136
137.c.o:
138	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
139
140LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
141$(LIBCOMPAT): always
142	(cd openbsd-compat && $(MAKE))
143always:
144
145libssh.a: $(LIBSSH_OBJS)
146	$(AR) rv $@ $(LIBSSH_OBJS)
147	$(RANLIB) $@
148
149ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
150	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS) $(GSSLIBS)
151
152sshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
153	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS) $(GSSLIBS) $(K5LIBS)
154
155scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
156	$(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
157
158ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
159	$(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
160
161ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o ssh-pkcs11-client.o
162	$(LD) -o $@ ssh-agent.o ssh-pkcs11-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
163
164ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
165	$(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
166
167ssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o roaming_dummy.o readconf.o
168	$(LD) -o $@ ssh-keysign.o readconf.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
169
170ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-pkcs11-helper.o ssh-pkcs11.o
171	$(LD) -o $@ ssh-pkcs11-helper.o ssh-pkcs11.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
172
173ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o roaming_dummy.o
174	$(LD) -o $@ ssh-keyscan.o roaming_dummy.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
175
176sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o sftp-server-main.o
177	$(LD) -o $@ sftp-server.o sftp-common.o sftp-server-main.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
178
179sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o
180	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
181
182# test driver for the loginrec code - not built by default
183logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
184	$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
185
186$(MANPAGES): $(MANPAGES_IN)
187	if test "$(MANTYPE)" = "cat"; then \
188		manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
189	else \
190		manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
191	fi; \
192	if test "$(MANTYPE)" = "man"; then \
193		$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) | \
194		    $(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
195	else \
196		$(FIXPATHSCMD) $${manpage} | $(FIXALGORITHMSCMD) > $@; \
197	fi
198
199$(CONFIGFILES): $(CONFIGFILES_IN)
200	conffile=`echo $@ | sed 's/.out$$//'`; \
201	$(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
202
203# fake rule to stop make trying to compile moduli.o into a binary "moduli.o"
204moduli:
205	echo
206
207# special case target for umac128
208umac128.o:	umac.c
209	$(CC) $(CFLAGS) $(CPPFLAGS) -o umac128.o -c $(srcdir)/umac.c \
210	    -DUMAC_OUTPUT_LEN=16 -Dumac_new=umac128_new \
211	    -Dumac_update=umac128_update -Dumac_final=umac128_final \
212	    -Dumac_delete=umac128_delete
213
214clean:	regressclean
215	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
216	rm -f *.out core survey
217	(cd openbsd-compat && $(MAKE) clean)
218
219distclean:	regressclean
220	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
221	rm -f *.out core opensshd.init openssh.xml
222	rm -f Makefile buildpkg.sh config.h config.status
223	rm -f survey.sh openbsd-compat/regress/Makefile *~
224	rm -rf autom4te.cache
225	(cd openbsd-compat && $(MAKE) distclean)
226	if test -d pkg ; then \
227		rm -fr pkg ; \
228	fi
229
230veryclean: distclean
231	rm -f configure config.h.in *.0
232
233cleandir: veryclean
234
235mrproper: veryclean
236
237realclean: veryclean
238
239catman-do:
240	@for f in $(MANPAGES_IN) ; do \
241		base=`echo $$f | sed 's/\..*$$//'` ; \
242		echo "$$f -> $$base.0" ; \
243		$(MANFMT) $$f | cat -v | sed -e 's/.\^H//g' \
244			>$$base.0 ; \
245	done
246
247distprep: catman-do
248	$(AUTORECONF)
249	-rm -rf autom4te.cache
250
251install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
252install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf
253install-nosysconf: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
254
255check-config:
256	-$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
257
258install-files:
259	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
260	$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
261	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
262	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
263	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)5
264	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
265	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
266	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
267	$(INSTALL) -m 0755 $(STRIP_OPT) ssh$(EXEEXT) $(DESTDIR)$(bindir)/ssh$(EXEEXT)
268	$(INSTALL) -m 0755 $(STRIP_OPT) scp$(EXEEXT) $(DESTDIR)$(bindir)/scp$(EXEEXT)
269	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add$(EXEEXT) $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
270	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent$(EXEEXT) $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
271	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
272	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan$(EXEEXT) $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
273	$(INSTALL) -m 0755 $(STRIP_OPT) sshd$(EXEEXT) $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
274	$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign$(EXEEXT) $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
275	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-pkcs11-helper$(EXEEXT) $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
276	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
277	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
278	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
279	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
280	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
281	$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
282	$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
283	$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
284	$(INSTALL) -m 644 moduli.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/moduli.5
285	$(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
286	$(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
287	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
288	$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
289	$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
290	$(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
291	$(INSTALL) -m 644 ssh-pkcs11-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
292	-rm -f $(DESTDIR)$(bindir)/slogin
293	ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
294	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
295	ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
296
297install-sysconf:
298	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
299		$(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
300	fi
301	@if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
302		$(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
303	else \
304		echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
305	fi
306	@if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
307		$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
308	else \
309		echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
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 "$(sysconfdir)/ssh_host_key" ] ; then \
325			echo "$(sysconfdir)/ssh_host_key already exists, skipping." ; \
326		else \
327			./ssh-keygen -t rsa1 -f $(sysconfdir)/ssh_host_key -N "" ; \
328		fi ; \
329		if [ -f $(sysconfdir)/ssh_host_dsa_key ] ; then \
330			echo "$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \
331		else \
332			./ssh-keygen -t dsa -f $(sysconfdir)/ssh_host_dsa_key -N "" ; \
333		fi ; \
334		if [ -f $(sysconfdir)/ssh_host_rsa_key ] ; then \
335			echo "$(sysconfdir)/ssh_host_rsa_key already exists, skipping." ; \
336		else \
337			./ssh-keygen -t rsa -f $(sysconfdir)/ssh_host_rsa_key -N "" ; \
338		fi ; \
339		if [ -f $(sysconfdir)/ssh_host_ed25519_key ] ; then \
340			echo "$(sysconfdir)/ssh_host_ed25519_key already exists, skipping." ; \
341		else \
342			./ssh-keygen -t ed25519 -f $(sysconfdir)/ssh_host_ed25519_key -N "" ; \
343		fi ; \
344		if [ -z "@COMMENT_OUT_ECC@" ] ; then \
345		    if [ -f $(sysconfdir)/ssh_host_ecdsa_key ] ; then \
346			echo "$(sysconfdir)/ssh_host_ecdsa_key already exists, skipping." ; \
347		    else \
348			./ssh-keygen -t ecdsa -f $(sysconfdir)/ssh_host_ecdsa_key -N "" ; \
349		    fi ; \
350		fi ; \
351	fi ;
352
353host-key-force: ssh-keygen$(EXEEXT)
354	./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N ""
355	./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
356	./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
357	./ssh-keygen -t ed25519 -f $(DESTDIR)$(sysconfdir)/ssh_host_ed25519_key -N ""
358	test -z "@COMMENT_OUT_ECC@" && ./ssh-keygen -t ecdsa -f $(DESTDIR)$(sysconfdir)/ssh_host_ecdsa_key -N ""
359
360uninstallall:	uninstall
361	-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
362	-rm -f $(DESTDIR)$(sysconfdir)/sshd_config
363	-rmdir $(DESTDIR)$(sysconfdir)
364	-rmdir $(DESTDIR)$(bindir)
365	-rmdir $(DESTDIR)$(sbindir)
366	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
367	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
368	-rmdir $(DESTDIR)$(mandir)
369	-rmdir $(DESTDIR)$(libexecdir)
370
371uninstall:
372	-rm -f $(DESTDIR)$(bindir)/slogin
373	-rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
374	-rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
375	-rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
376	-rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
377	-rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
378	-rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
379	-rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
380	-rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
381	-rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
382	-rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
383	-rm -f $(DESTDIR)$(SSH_PKCS11_HELPER)$(EXEEXT)
384	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
385	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
386	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
387	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
388	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
389	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
390	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
391	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
392	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
393	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
394	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-pkcs11-helper.8
395	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
396
397regress/modpipe$(EXEEXT): $(srcdir)/regress/modpipe.c
398	[ -d `pwd`/regress ]  ||  mkdir -p `pwd`/regress
399	[ -f `pwd`/regress/Makefile ]  || \
400	    ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
401	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
402	$(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
403
404regress/setuid-allowed$(EXEEXT): $(srcdir)/regress/setuid-allowed.c
405	[ -d `pwd`/regress ]  ||  mkdir -p `pwd`/regress
406	[ -f `pwd`/regress/Makefile ]  || \
407	    ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile
408	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $? \
409	$(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS)
410
411tests interop-tests:	$(TARGETS) regress/modpipe$(EXEEXT) regress/setuid-allowed$(EXEEXT)
412	BUILDDIR=`pwd`; \
413	TEST_SHELL="@TEST_SHELL@"; \
414	TEST_SSH_SCP="$${BUILDDIR}/scp"; \
415	TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
416	TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
417	TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
418	TEST_SSH_SSHADD="$${BUILDDIR}/ssh-add"; \
419	TEST_SSH_SSHKEYGEN="$${BUILDDIR}/ssh-keygen"; \
420	TEST_SSH_SSHPKCS11HELPER="$${BUILDDIR}/ssh-pkcs11-helper"; \
421	TEST_SSH_SSHKEYSCAN="$${BUILDDIR}/ssh-keyscan"; \
422	TEST_SSH_SFTP="$${BUILDDIR}/sftp"; \
423	TEST_SSH_SFTPSERVER="$${BUILDDIR}/sftp-server"; \
424	TEST_SSH_PLINK="plink"; \
425	TEST_SSH_PUTTYGEN="puttygen"; \
426	TEST_SSH_CONCH="conch"; \
427	TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \
428	TEST_SSH_ECC="@TEST_SSH_ECC@" ; \
429	cd $(srcdir)/regress || exit $$?; \
430	$(MAKE) \
431		.OBJDIR="$${BUILDDIR}/regress" \
432		.CURDIR="`pwd`" \
433		BUILDDIR="$${BUILDDIR}" \
434		OBJ="$${BUILDDIR}/regress/" \
435		PATH="$${BUILDDIR}:$${PATH}" \
436		TEST_ENV=MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
437		TEST_SHELL="$${TEST_SHELL}" \
438		TEST_SSH_SCP="$${TEST_SSH_SCP}" \
439		TEST_SSH_SSH="$${TEST_SSH_SSH}" \
440		TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
441		TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
442		TEST_SSH_SSHADD="$${TEST_SSH_SSHADD}" \
443		TEST_SSH_SSHKEYGEN="$${TEST_SSH_SSHKEYGEN}" \
444		TEST_SSH_SSHPKCS11HELPER="$${TEST_SSH_SSHPKCS11HELPER}" \
445		TEST_SSH_SSHKEYSCAN="$${TEST_SSH_SSHKEYSCAN}" \
446		TEST_SSH_SFTP="$${TEST_SSH_SFTP}" \
447		TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
448		TEST_SSH_PLINK="$${TEST_SSH_PLINK}" \
449		TEST_SSH_PUTTYGEN="$${TEST_SSH_PUTTYGEN}" \
450		TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \
451		TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \
452		TEST_SSH_ECC="$${TEST_SSH_ECC}" \
453		EXEEXT="$(EXEEXT)" \
454		$@ && echo all tests passed
455
456compat-tests: $(LIBCOMPAT)
457	(cd openbsd-compat/regress && $(MAKE))
458
459regressclean:
460	if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \
461		(cd regress && $(MAKE) clean) \
462	fi
463
464survey: survey.sh ssh
465	@$(SHELL) ./survey.sh > survey
466	@echo 'The survey results have been placed in the file "survey" in the'
467	@echo 'current directory.  Please review the file then send with'
468	@echo '"make send-survey".'
469
470send-survey:	survey
471	mail portable-survey@mindrot.org <survey
472
473package: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
474	if [ "@MAKE_PACKAGE_SUPPORTED@" = yes ]; then \
475		sh buildpkg.sh; \
476	fi
477