Makefile.in revision 164146
1164146Sdes# $Id: Makefile.in,v 1.283 2006/10/23 21:44:47 tim 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
2898937SdesRAND_HELPER=$(libexecdir)/ssh-rand-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)\" \
3898937Sdes	-D_PATH_SSH_PIDDIR=\"$(piddir)\" \
3998937Sdes	-D_PATH_PRIVSEP_CHROOT_DIR=\"$(PRIVSEP_PATH)\" \
4098937Sdes	-DSSH_RAND_HELPER=\"$(RAND_HELPER)\"
4198937Sdes
4298937SdesCC=@CC@
4398937SdesLD=@LD@
4498937SdesCFLAGS=@CFLAGS@
4598937SdesCPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
4698937SdesLIBS=@LIBS@
47162852SdesLIBSELINUX=@LIBSELINUX@
48162852SdesSSHDLIBS=@SSHDLIBS@
49146998SdesLIBEDIT=@LIBEDIT@
5098937SdesLIBPAM=@LIBPAM@
5198937SdesLIBWRAP=@LIBWRAP@
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@
6298937Sdes
6398937SdesINSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@
6498937SdesINSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@
6598937Sdes
66113908SdesTARGETS=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)
6798937Sdes
68162852SdesLIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o bufbn.o buffer.o \
69126274Sdes	canohost.o channels.o cipher.o cipher-acss.o cipher-aes.o \
70126274Sdes	cipher-bf1.o cipher-ctr.o cipher-3des1.o cleanup.o \
71126274Sdes	compat.o compress.o crc32.o deattack.o fatal.o hostfile.o \
72162852Sdes	log.o match.o md-sha256.o moduli.o nchan.o packet.o \
73149749Sdes	readpass.o rsa.o ttymodes.o xmalloc.o \
74137015Sdes	atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
75137015Sdes	monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \
76137015Sdes	kexgex.o kexdhc.o kexgexc.o scard.o msg.o progressmeter.o dns.o \
77124208Sdes	entropy.o scard-opensc.o gss-genr.o
7898937Sdes
79113908SdesSSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
80113908Sdes	sshconnect.o sshconnect1.o sshconnect2.o
8198937Sdes
82113908SdesSSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
83137015Sdes	sshpty.o sshlogin.o servconf.o serverloop.o \
84113908Sdes	auth.o auth1.o auth2.o auth-options.o session.o \
85113908Sdes	auth-chall.o auth2-chall.o groupaccess.o \
86113908Sdes	auth-skey.o auth-bsdauth.o auth2-hostbased.o auth2-kbdint.o \
87113908Sdes	auth2-none.o auth2-passwd.o auth2-pubkey.o \
88137015Sdes	monitor_mm.o monitor.o monitor_wrap.o kexdhs.o kexgexs.o \
89124208Sdes	auth-krb5.o \
90124208Sdes	auth2-gss.o gss-serv.o gss-serv-krb5.o \
91146998Sdes	loginrec.o auth-pam.o auth-shadow.o auth-sia.o md5crypt.o \
92162852Sdes	audit.o audit-bsm.o platform.o
9398937Sdes
9498937SdesMANPAGES	= 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
9598937SdesMANPAGES_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
9698937SdesMANTYPE		= @MANTYPE@
9798937Sdes
9898937SdesCONFIGFILES=sshd_config.out ssh_config.out moduli.out
9998937SdesCONFIGFILES_IN=sshd_config ssh_config moduli
10098937Sdes
10198937SdesPATHSUBS	= \
102113908Sdes	-e 's|/etc/ssh/ssh_prng_cmds|$(sysconfdir)/ssh_prng_cmds|g' \
103113908Sdes	-e 's|/etc/ssh/ssh_config|$(sysconfdir)/ssh_config|g' \
104113908Sdes	-e 's|/etc/ssh/ssh_known_hosts|$(sysconfdir)/ssh_known_hosts|g' \
105113908Sdes	-e 's|/etc/ssh/sshd_config|$(sysconfdir)/sshd_config|g' \
106113908Sdes	-e 's|/usr/libexec|$(libexecdir)|g' \
107113908Sdes	-e 's|/etc/shosts.equiv|$(sysconfdir)/shosts.equiv|g' \
108113908Sdes	-e 's|/etc/ssh/ssh_host_key|$(sysconfdir)/ssh_host_key|g' \
109113908Sdes	-e 's|/etc/ssh/ssh_host_dsa_key|$(sysconfdir)/ssh_host_dsa_key|g' \
110113908Sdes	-e 's|/etc/ssh/ssh_host_rsa_key|$(sysconfdir)/ssh_host_rsa_key|g' \
111113908Sdes	-e 's|/var/run/sshd.pid|$(piddir)/sshd.pid|g' \
112113908Sdes	-e 's|/etc/ssh/moduli|$(sysconfdir)/moduli|g' \
113162852Sdes	-e 's|/etc/ssh/sshrc|$(sysconfdir)/sshrc|g' \
114113908Sdes	-e 's|/usr/X11R6/bin/xauth|$(XAUTH_PATH)|g' \
115113908Sdes	-e 's|/var/empty|$(PRIVSEP_PATH)|g' \
116113908Sdes	-e 's|/usr/bin:/bin:/usr/sbin:/sbin|@user_path@|g'
11798937Sdes
118113908SdesFIXPATHSCMD	= $(SED) $(PATHSUBS)
11998937Sdes
120124208Sdesall: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS)
12198937Sdes
122124208Sdes$(LIBSSH_OBJS): Makefile.in config.h
123124208Sdes$(SSHOBJS): Makefile.in config.h
124124208Sdes$(SSHDOBJS): Makefile.in config.h
12598937Sdes
12698937Sdes.c.o:
12798937Sdes	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
12898937Sdes
12998937SdesLIBCOMPAT=openbsd-compat/libopenbsd-compat.a
13098937Sdes$(LIBCOMPAT): always
13198937Sdes	(cd openbsd-compat && $(MAKE))
13298937Sdesalways:
13398937Sdes
13498937Sdeslibssh.a: $(LIBSSH_OBJS)
13598937Sdes	$(AR) rv $@ $(LIBSSH_OBJS)
13698937Sdes	$(RANLIB) $@
13798937Sdes
13898937Sdesssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
13998937Sdes	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
14098937Sdes
14198937Sdessshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
142162852Sdes	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBSELINUX) $(SSHDLIBS) $(LIBS)
14398937Sdes
144113908Sdesscp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
145157016Sdes	$(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
14698937Sdes
14798937Sdesssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
148126274Sdes	$(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
14998937Sdes
15098937Sdesssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o
151126274Sdes	$(LD) -o $@ ssh-agent.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
15298937Sdes
15398937Sdesssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
154126274Sdes	$(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
15598937Sdes
15698937Sdesssh-keysign$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keysign.o
157126274Sdes	$(LD) -o $@ ssh-keysign.o readconf.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
15898937Sdes
15998937Sdesssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
160126274Sdes	$(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
16198937Sdes
16298937Sdessftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o
163126274Sdes	$(LD) -o $@ sftp-server.o sftp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
16498937Sdes
165126274Sdessftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-common.o sftp-glob.o progressmeter.o
166146998Sdes	$(LD) -o $@ progressmeter.o sftp.o sftp-client.o sftp-common.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) $(LIBEDIT)
16798937Sdes
16898937Sdesssh-rand-helper${EXEEXT}: $(LIBCOMPAT) libssh.a ssh-rand-helper.o
16998937Sdes	$(LD) -o $@ ssh-rand-helper.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
17098937Sdes
17198937Sdes# test driver for the loginrec code - not built by default
17298937Sdeslogintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
17398937Sdes	$(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
17498937Sdes
17598937Sdes$(MANPAGES): $(MANPAGES_IN)
17698937Sdes	if test "$(MANTYPE)" = "cat"; then \
17798937Sdes		manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
17898937Sdes	else \
17998937Sdes		manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
18098937Sdes	fi; \
18198937Sdes	if test "$(MANTYPE)" = "man"; then \
182124208Sdes		$(FIXPATHSCMD) $${manpage} | $(AWK) -f $(srcdir)/mdoc2man.awk > $@; \
18398937Sdes	else \
18498937Sdes		$(FIXPATHSCMD) $${manpage} > $@; \
18598937Sdes	fi
18698937Sdes
18798937Sdes$(CONFIGFILES): $(CONFIGFILES_IN)
18898937Sdes	conffile=`echo $@ | sed 's/.out$$//'`; \
18998937Sdes	$(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
19098937Sdes
191124208Sdesssh_prng_cmds.out:	ssh_prng_cmds
192124208Sdes	if test ! -z "$(INSTALL_SSH_PRNG_CMDS)"; then \
193124208Sdes		$(PERL) $(srcdir)/fixprogs ssh_prng_cmds $(ENT); \
194124208Sdes	fi
195124208Sdes
196149749Sdes# fake rule to stop make trying to compile moduli.o into a binary "moduli.o"
197124208Sdesmoduli:
198124208Sdes	echo
199124208Sdes
200124208Sdesclean:	regressclean
201126274Sdes	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
202146998Sdes	rm -f *.out core survey
20398937Sdes	(cd openbsd-compat && $(MAKE) clean)
20498937Sdes
205124208Sdesdistclean:	regressclean
206126274Sdes	rm -f *.o *.a $(TARGETS) logintest config.cache config.log
207162852Sdes	rm -f *.out core opensshd.init openssh.xml
208162852Sdes	rm -f Makefile buildpkg.sh config.h config.status ssh_prng_cmds
209162852Sdes	rm -f survey.sh openbsd-compat/regress/Makefile *~ 
21098937Sdes	rm -rf autom4te.cache
21198937Sdes	(cd openbsd-compat && $(MAKE) distclean)
21298937Sdes	(cd scard && $(MAKE) distclean)
213137015Sdes	if test -d pkg ; then \
214137015Sdes		rm -fr pkg ; \
215137015Sdes	fi
21698937Sdes
217124208Sdesveryclean: distclean
21898937Sdes	rm -f configure config.h.in *.0
21998937Sdes
220124208Sdesmrproper: veryclean
22198937Sdes
222124208Sdesrealclean: veryclean
223124208Sdes
22498937Sdescatman-do:
22598937Sdes	@for f in $(MANPAGES_IN) ; do \
22698937Sdes		base=`echo $$f | sed 's/\..*$$//'` ; \
22798937Sdes		echo "$$f -> $$base.0" ; \
22898937Sdes		nroff -mandoc $$f | cat -v | sed -e 's/.\^H//g' \
22998937Sdes			>$$base.0 ; \
23098937Sdes	done
23198937Sdes
23298937Sdesdistprep: catman-do
23398937Sdes	$(AUTORECONF)
234126274Sdes	-rm -rf autom4te.cache
23598937Sdes	(cd scard && $(MAKE) -f Makefile.in distprep)
23698937Sdes
237146998Sdesinstall: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config
238146998Sdesinstall-nokeys: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files install-sysconf
239146998Sdesinstall-nosysconf: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS) install-files
24098937Sdes
241106121Sdescheck-config:
242106121Sdes	-$(DESTDIR)$(sbindir)/sshd -t -f $(DESTDIR)$(sysconfdir)/sshd_config
24399060Sdes
24498937Sdesscard-install:
24598937Sdes	(cd scard && $(MAKE) DESTDIR=$(DESTDIR) install)
24698937Sdes
24798937Sdesinstall-files: scard-install
24898937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
24998937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
25098937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
25198937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)
25298937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
25398937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)5
25498937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
25598937Sdes	$(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
256106121Sdes	(umask 022 ; $(srcdir)/mkinstalldirs $(DESTDIR)$(PRIVSEP_PATH))
257113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh $(DESTDIR)$(bindir)/ssh
258113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) scp $(DESTDIR)$(bindir)/scp
259113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-add $(DESTDIR)$(bindir)/ssh-add
260113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-agent $(DESTDIR)$(bindir)/ssh-agent
261113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen
262113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan
263113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) sshd $(DESTDIR)$(sbindir)/sshd
26498937Sdes	if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \
265113908Sdes		$(INSTALL) -m 0755 $(STRIP_OPT) ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \
26698937Sdes	fi
267113908Sdes	$(INSTALL) -m 4711 $(STRIP_OPT) ssh-keysign $(DESTDIR)$(SSH_KEYSIGN)
268113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) sftp $(DESTDIR)$(bindir)/sftp
269113908Sdes	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server $(DESTDIR)$(SFTP_SERVER)
27098937Sdes	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
27198937Sdes	$(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
27298937Sdes	$(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
27398937Sdes	$(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
27498937Sdes	$(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
27598937Sdes	$(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
27698937Sdes	$(INSTALL) -m 644 sshd_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/sshd_config.5
27798937Sdes	$(INSTALL) -m 644 ssh_config.5.out $(DESTDIR)$(mandir)/$(mansubdir)5/ssh_config.5
27898937Sdes	$(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
27999060Sdes	if [ ! -z "$(INSTALL_SSH_RAND_HELPER)" ]; then \
28098937Sdes		$(INSTALL) -m 644 ssh-rand-helper.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-rand-helper.8 ; \
28198937Sdes	fi
282113908Sdes	$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
283113908Sdes	$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
28498937Sdes	$(INSTALL) -m 644 ssh-keysign.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
28598937Sdes	-rm -f $(DESTDIR)$(bindir)/slogin
286106121Sdes	ln -s ./ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
28798937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
288106121Sdes	ln -s ./ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
289146998Sdes
290146998Sdesinstall-sysconf:
29198937Sdes	if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
29298937Sdes		$(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
29398937Sdes	fi
294106121Sdes	@if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
29598937Sdes		$(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
29698937Sdes	else \
29798937Sdes		echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
29898937Sdes	fi
299106121Sdes	@if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
30098937Sdes		$(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
30198937Sdes	else \
30298937Sdes		echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
30398937Sdes	fi
304146998Sdes	@if [ -f ssh_prng_cmds ] && [ ! -z "$(INSTALL_SSH_PRNG_CMDS)" ]; then \
30598937Sdes		if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_prng_cmds ] ; then \
30698937Sdes			$(INSTALL) -m 644 ssh_prng_cmds.out $(DESTDIR)$(sysconfdir)/ssh_prng_cmds; \
30798937Sdes		else \
30898937Sdes			echo "$(DESTDIR)$(sysconfdir)/ssh_prng_cmds already exists, install will not overwrite"; \
30998937Sdes		fi ; \
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 \
32498937Sdes		if [ -f "$(DESTDIR)$(sysconfdir)/ssh_host_key" ] ; then \
32598937Sdes			echo "$(DESTDIR)$(sysconfdir)/ssh_host_key already exists, skipping." ; \
32698937Sdes		else \
32798937Sdes			./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N "" ; \
32898937Sdes		fi ; \
32998937Sdes		if [ -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key ] ; then \
33098937Sdes			echo "$(DESTDIR)$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \
33198937Sdes		else \
33298937Sdes			./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N "" ; \
33398937Sdes		fi ; \
33498937Sdes		if [ -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key ] ; then \
33598937Sdes			echo "$(DESTDIR)$(sysconfdir)/ssh_host_rsa_key already exists, skipping." ; \
33698937Sdes		else \
33798937Sdes			./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N "" ; \
33898937Sdes		fi ; \
33998937Sdes	fi ;
34098937Sdes
34198937Sdeshost-key-force: ssh-keygen$(EXEEXT)
34298937Sdes	./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N ""
34398937Sdes	./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
34498937Sdes	./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
34598937Sdes
34698937Sdesuninstallall:	uninstall
34798937Sdes	-rm -f $(DESTDIR)$(sysconfdir)/ssh_config
34898937Sdes	-rm -f $(DESTDIR)$(sysconfdir)/sshd_config
34998937Sdes	-rm -f $(DESTDIR)$(sysconfdir)/ssh_prng_cmds
35098937Sdes	-rmdir $(DESTDIR)$(sysconfdir)
35198937Sdes	-rmdir $(DESTDIR)$(bindir)
35298937Sdes	-rmdir $(DESTDIR)$(sbindir)
35398937Sdes	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
35498937Sdes	-rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
35598937Sdes	-rmdir $(DESTDIR)$(mandir)
35698937Sdes	-rmdir $(DESTDIR)$(libexecdir)
35798937Sdes
358126274Sdesuninstall:
35998937Sdes	-rm -f $(DESTDIR)$(bindir)/slogin
36098937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
36198937Sdes	-rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
36298937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
36398937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
36498937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
36598937Sdes	-rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
36698937Sdes	-rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
36798937Sdes	-rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
36898937Sdes	-rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
36998937Sdes	-rm -f $(DESTDIR)$(SSH_KEYSIGN)$(EXEEXT)
37098937Sdes	-rm -f $(DESTDIR)$(RAND_HELPER)$(EXEEXT)
37198937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
37298937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
37398937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
37498937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
37598937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
37698937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
37798937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
37898937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
37998937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-rand-helper.8
38098937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
38198937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/ssh-keysign.8
38298937Sdes	-rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
383124208Sdes
384124208Sdestests:	$(TARGETS)
385124208Sdes	BUILDDIR=`pwd`; \
386124208Sdes	[ -d `pwd`/regress ]  ||  mkdir -p `pwd`/regress; \
387124208Sdes	[ -f `pwd`/regress/Makefile ]  || \
388146998Sdes	    ln -s `cd $(srcdir) && pwd`/regress/Makefile `pwd`/regress/Makefile ; \
389137015Sdes	TEST_SHELL="@TEST_SHELL@"; \
390124208Sdes	TEST_SSH_SSH="$${BUILDDIR}/ssh"; \
391124208Sdes	TEST_SSH_SSHD="$${BUILDDIR}/sshd"; \
392124208Sdes	TEST_SSH_SSHAGENT="$${BUILDDIR}/ssh-agent"; \
393124208Sdes	TEST_SSH_SSHADD="$${BUILDDIR}/ssh-add"; \
394124208Sdes	TEST_SSH_SSHKEYGEN="$${BUILDDIR}/ssh-keygen"; \
395124208Sdes	TEST_SSH_SSHKEYSCAN="$${BUILDDIR}/ssh-keyscan"; \
396124208Sdes	TEST_SSH_SFTP="$${BUILDDIR}/sftp"; \
397124208Sdes	TEST_SSH_SFTPSERVER="$${BUILDDIR}/sftp-server"; \
398124208Sdes	cd $(srcdir)/regress || exit $$?; \
399124208Sdes	$(MAKE) \
400124208Sdes		.OBJDIR="$${BUILDDIR}/regress" \
401124208Sdes		.CURDIR="`pwd`" \
402124208Sdes		BUILDDIR="$${BUILDDIR}" \
403124208Sdes		OBJ="$${BUILDDIR}/regress/" \
404124208Sdes		PATH="$${BUILDDIR}:$${PATH}" \
405126274Sdes		TEST_SHELL="$${TEST_SHELL}" \
406124208Sdes		TEST_SSH_SSH="$${TEST_SSH_SSH}" \
407124208Sdes		TEST_SSH_SSHD="$${TEST_SSH_SSHD}" \
408124208Sdes		TEST_SSH_SSHAGENT="$${TEST_SSH_SSHAGENT}" \
409124208Sdes		TEST_SSH_SSHADD="$${TEST_SSH_SSHADD}" \
410124208Sdes		TEST_SSH_SSHKEYGEN="$${TEST_SSH_SSHKEYGEN}" \
411124208Sdes		TEST_SSH_SSHKEYSCAN="$${TEST_SSH_SSHKEYSCAN}" \
412124208Sdes		TEST_SSH_SFTP="$${TEST_SSH_SFTP}" \
413124208Sdes		TEST_SSH_SFTPSERVER="$${TEST_SSH_SFTPSERVER}" \
414124208Sdes		EXEEXT="$(EXEEXT)" \
415124208Sdes		$@
416124208Sdes
417162852Sdescompat-tests: $(LIBCOMPAT)
418162852Sdes	(cd openbsd-compat/regress && $(MAKE))
419162852Sdes
420124208Sdesregressclean:
421146998Sdes	if [ -f regress/Makefile ] && [ -r regress/Makefile ]; then \
422124208Sdes		(cd regress && $(MAKE) clean) \
423124208Sdes	fi
424137015Sdes
425146998Sdessurvey: survey.sh ssh
426146998Sdes	@$(SHELL) ./survey.sh > survey
427146998Sdes	@echo 'The survey results have been placed in the file "survey" in the'
428146998Sdes	@echo 'current directory.  Please review the file then send with'
429146998Sdes	@echo '"make send-survey".'
430146998Sdes
431146998Sdessend-survey:	survey
432146998Sdes	mail portable-survey@mindrot.org <survey
433146998Sdes
434137015Sdespackage: $(CONFIGFILES) ssh_prng_cmds.out $(MANPAGES) $(TARGETS)
435137015Sdes	if [ "@MAKE_PACKAGE_SUPPORTED@" = yes ]; then \
436137015Sdes		sh buildpkg.sh; \
437137015Sdes	fi
438137015Sdes
439