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