# Generated automatically from Makefile.in by configure.
#
# Makefile.in
#
# Author: Tatu Ylonen <ylo@cs.hut.fi>
#
# Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#                    All rights reserved
#
# Created: Wed Mar 22 17:37:49 1995 ylo
#
# $Id: Makefile.in,v 1.7 1996/06/03 20:06:14 ylo Exp $
# $Log: Makefile.in,v $
# Revision 1.7  1996/06/03 20:06:14  ylo
# 	Removed ssh-askpass.wish from DISTFILES.
# 	Removed explicit rule for ssh-askpass.o.  It breaks
# 	compilations in separate object directory.
# 	Added X_CFLAGS in .c.o rule; it is needed for ssh-askpass.
#
# Revision 1.6  1996/05/28 12:46:10  ylo
# 	Cosmetic changes.
#
# Revision 1.5  1996/04/26 00:42:37  ylo
# 	Don't include make-ssh-known-hosts.1 in DISTFILES (it is generated).
# 	Avoid double -m options to install; some machines don't like it.
# 	Removed some obsolete rm commands that were there for compatibility.
#
# Revision 1.4  1996/04/22 23:31:32  huima
# Added ssh-askpass in C. Added general support for X programs.
#
# Revision 1.3  1996/03/05  18:38:31  huima
# Edd target. Edd not included in 'all'.
#
# Revision 1.1  1996/02/18  21:38:13  ylo
# Initial revision
#
# Revision 1.18  1995/10/02  01:17:20  ylo
# 	Added PIDDIR.
# 	Added missing socketpair.c to EXTRA_SRCS.
# 	Some manual pages now generated by configure.
# 	Remove old /etc/sshd_pid.
# 	Fixed install_prefix.
#
# Revision 1.17  1995/09/27  02:09:12  ylo
# 	Made etcdir configurable with --with-etcdir=PATH.
#
# Revision 1.16  1995/09/24  23:56:51  ylo
# 	New file clientloop.c.
#
# Revision 1.15  1995/09/10  23:25:10  ylo
# 	Added osfc2.c to EXTRA_SRCS.
#
# Revision 1.14  1995/09/10  22:44:02  ylo
# 	Reorganized OBJS lists.
# 	Added serverloop.o.
#
# Revision 1.13  1995/09/09  21:26:18  ylo
# 	Added uidswap.o, ChangeLog.
#
# Revision 1.12  1995/09/06  15:56:25  ylo
# 	Replace ETCDIR in server_config.sample.
#
# Revision 1.11  1995/08/31  09:42:47  ylo
# 	Added $(exec_prefix) and $(etcdir) to the list of directories
# 	to create.
#
# Revision 1.10  1995/08/31  09:18:05  ylo
# 	Added $(etcdir).
#
# Revision 1.9  1995/08/29  22:17:26  ylo
# 	Moved sshd to $prefix/sbin.
# 	Added improved file descriptor code from David Mazieres.
# 	Changed ssh-keygen to use file name option.
# 	Added missing files to clean.
#
# Revision 1.8  1995/08/22  14:04:56  ylo
# 	Removed references to obsolete DESDEP.
#
# Revision 1.7  1995/08/21  23:19:06  ylo
# 	Added server config stuff.
#
# Revision 1.6  1995/08/18  22:40:28  ylo
# 	Added install_prefix.
# 	Added CONFOBJS, and moved idea.o to CONFOBJS.
# 	Added config.guess and config.sub to DISTFILES.
#
# Revision 1.5  1995/07/26  17:09:21  ylo
# 	Added mpaux.o.
#
# Revision 1.4  1995/07/15  13:26:55  ylo
# 	Added putenv.c to EXTRA_SRCS.
#
# Revision 1.3  1995/07/13  01:06:27  ylo
# 	Added cvs log.
#
# $Endlog$

srcdir 		= .


install_prefix	=
prefix		= /usr/local
exec_prefix	= ${prefix}
bindir		= ${exec_prefix}/bin
sbindir		= ${exec_prefix}/sbin
mandir		= ${prefix}/man
man1dir		= $(mandir)/man1
man8dir		= $(mandir)/man8
etcdir		= /etc
piddir		= /var/run

CC 		= gcc -pipe
CFLAGS 		= -g -O
LDFLAGS		= 
DEFS 		= -DHAVE_CONFIG_H
LIBS		= -lshadow -L/usr/local/lib  -lshadow
LIBOBJS		= 
CONFOBJS	=  idea.o

MAKEDEP		= makedepend
LN_S		= ln -s
RANLIB		= ranlib
INSTALL		= /usr/bin/ginstall -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA	= ${INSTALL} -m 644
WISH		= @WISH@
PERL		= /usr/bin/perl

RSAREFDEP	= 

transform	= s,x,x,

HOST_KEY_FILE 	= $(etcdir)/ssh_host_key
HOST_CONFIG_FILE = $(etcdir)/ssh_config
SERVER_CONFIG_FILE = $(etcdir)/sshd_config

SHELL = /bin/sh

GMPDIR 		= gmp-1.3.2
GMPLIBS 	= -L$(GMPDIR) -lgmp
GMPDEP 		= $(GMPDIR)/gmp.h $(GMPDIR)/libgmp.a

ZLIBDIR		= zlib095
ZLIBDEP		= $(ZLIBDIR)/libz.a
ZLIBLIBS	= -L$(ZLIBDIR) -lz

RSAREFDIR	= rsaref2
RSAREFSRCDIR 	= $(RSAREFDIR)/source

X_CFLAGS	=  -I/usr/X11R6/include
X_LIBS		=  -L/usr/X11R6/lib
X_PRE_LIBS	=  -lSM -lICE
X_EXTRA_LIBS	= 

XLIBS		= $(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)

COMMON_OBJS = $(LIBOBJS) $(CONFOBJS) \
	rsa.o randoms.o md5.o buffer.o emulate.o packet.o compress.o \
	xmalloc.o ttymodes.o newchannels.o bufaux.o authfd.o authfile.o crc32.o \
	rsaglue.o tss.o cipher.o des.o match.o arcfour.o mpaux.o minfd.o \
	userfile.o signals.o
SSHD_OBJS = sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o \
	log-server.o login.o hostfile.o canohost.o servconf.o tildexpand.o \
	serverloop.o $(COMMON_OBJS)
SSH_OBJS = ssh.o sshconnect.o log-client.o readconf.o hostfile.o readpass.o \
	tildexpand.o clientloop.o canohost.o $(COMMON_OBJS)
KEYGEN_OBJS = ssh-keygen.o log-client.o readpass.o rsa.o randoms.o md5.o \
	buffer.o xmalloc.o authfile.o tss.o cipher.o des.o arcfour.o mpaux.o \
	bufaux.o userfile.o signals.o $(LIBOBJS) $(CONFOBJS)
AGENT_OBJS = ssh-agent.o log-client.o rsa.o randoms.o md5.o buffer.o \
	xmalloc.o bufaux.o authfd.o authfile.o rsaglue.o tss.o cipher.o \
	des.o arcfour.o mpaux.o minfd.o userfile.o signals.o $(LIBOBJS) $(CONFOBJS)
ADD_OBJS = ssh-add.o log-client.o readpass.o rsa.o randoms.o md5.o buffer.o \
	xmalloc.o bufaux.o authfd.o authfile.o tss.o cipher.o \
	des.o arcfour.o mpaux.o minfd.o userfile.o signals.o $(LIBOBJS) \
	$(CONFOBJS)
SCP_OBJS = scp.o xmalloc.o
GEN_MINFD_OBJS = gen_minfd.o $(LIBOBJS)
EDD_OBJS = rsa.o randoms.o md5.o buffer.o xmalloc.o bufaux.o authfd.o \
	authfile.o crc32.o rsaglue.o tss.o cipher.o des.o match.o arcfour.o \
	mpaux.o minfd.o userfile.o signals.o idea.o \
        readpass.o edd.o edd-block.o
SSH_ASKPASS_OBJS = ssh-askpass.o xmalloc.o

USER_SHELLS = sh jsh ksh csh tcsh bash zsh ash

SRCS = $(SSHD_OBJS:.o=.c) $(SSH_OBJS:.o=.c) $(KEYGEN_OBJS:.o=.c) \
	$(AGENT_OBJS:.o=.c) $(ADD_OBJS:.o=.c) \
	$(SCP_OBJS:.o=.c) \
	$(GEN_MINFD_OBJS:.o=.c) \
	$(SSH_ASKPASS_OBJS:.o=.c)
EXTRA_SRCS = memmove.c strerror.c remove.c random.c putenv.c crypt.c osfc2.c \
	socketpair.c
MAN1PAGES = ssh-keygen.1 ssh-agent.1 ssh-add.1 scp.1
MAN1GENERATED = ssh.1 make-ssh-known-hosts.1
MAN1SOURCES = ssh.1.in ssh-keygen.1 ssh-agent.1 ssh-add.1 scp.1 make-ssh-known-hosts.1.in
MAN8GENERATED = sshd.8
MAN8SOURCES = sshd.8.in

DISTFILES = COPYING README README.SECURID INSTALL TODO libdes-README \
	libdes-COPYING libdes-ARTISTIC gnu-COPYING-GPL OVERVIEW \
	configure configure.in config.guess config.sub Makefile.in \
	check-fds.c host_config.sample config.sample \
	acconfig.h config.h.in server_config.sample \
	$(MAN1SOURCES) $(MAN8SOURCES) $(SRCS) $(EXTRA_SRCS) *.h install-sh \
	make-ssh-known-hosts.pl RFC.nroff RFC rfc-pg.c \
	ChangeLog

DISTNAME = ssh-`sed 's/.*"\(.*\)".*/\1/' version.h`

NORMAL_PROGRAMS = ssh-keygen ssh-agent ssh-add scp ssh-askpass
SCRIPT_PROGRAMS = make-ssh-known-hosts
SBIN_PROGRAMS = sshd
PROGRAMS = ssh $(SBIN_PROGRAMS) $(NORMAL_PROGRAMS) $(SCRIPT_PROGRAMS)
SSH_PROGRAM = $(bindir)/ssh

all: $(PROGRAMS)

RFC: RFC.nroff rfc-pg
	tbl RFC.nroff | nroff -ms | sed 's/FORMFEED\[Page/        [Page/' | ./rfc-pg -n5 >RFC

rfc-pg: rfc-pg.c
	$(CC) -o rfc-pg rfc-pg.c

.c.o:
	$(CC) -c -I. -I$(srcdir)/$(GMPDIR) -I$(srcdir)/$(ZLIBDIR) $(DEFS) -DHOST_KEY_FILE=\"$(HOST_KEY_FILE)\" -DHOST_CONFIG_FILE=\"$(HOST_CONFIG_FILE)\" -DSERVER_CONFIG_FILE=\"$(SERVER_CONFIG_FILE)\" -DSSH_PROGRAM=\"$(SSH_PROGRAM)\" -DETCDIR=\"$(etcdir)\" -DPIDDIR=\"$(piddir)\" -DBINDIR=\"$(bindir)\" $(CFLAGS) $(X_CFLAGS) $<

sshd: $(SSHD_OBJS) $(GMPDEP) $(RSAREFDEP) $(ZLIBDEP)
	-rm -f sshd
	$(CC) $(LDFLAGS) -o sshd $(SSHD_OBJS) $(GMPLIBS) $(ZLIBLIBS) $(LIBS)

ssh: $(SSH_OBJS) $(GMPDEP) $(RSAREFDEP) $(ZLIBDEP)
	-rm -f ssh
	$(CC) $(LDFLAGS) -o ssh $(SSH_OBJS) $(GMPLIBS) $(ZLIBLIBS) $(LIBS)

ssh-keygen: $(KEYGEN_OBJS) $(GMPDEP) $(RSAREFDEP)
	-rm -f ssh-keygen
	$(CC) $(LDFLAGS) -o ssh-keygen $(KEYGEN_OBJS) $(GMPLIBS) $(LIBS)

ssh-agent: $(AGENT_OBJS) $(GMPDEP) $(RSAREFDEP)
	-rm -f ssh-agent
	$(CC) $(LDFLAGS) -o ssh-agent $(AGENT_OBJS) $(GMPLIBS) $(LIBS)

ssh-add: $(ADD_OBJS) $(GMPDEP) $(RSAREFDEP)
	-rm -f ssh-add
	$(CC) $(LDFLAGS) -o ssh-add $(ADD_OBJS) $(GMPLIBS) $(LIBS)

scp: $(SCP_OBJS) $(LIBOBJS) $(RSAREFDEP)
	-rm -f scp
	$(CC) $(LDFLAGS) -o scp $(SCP_OBJS) $(LIBOBJS) $(LIBS)

ssh-askpass: $(SSH_ASKPASS_OBJS)
	-rm -f ssh-askpass
	$(CC) $(LDFLAGS) -o ssh-askpass $(SSH_ASKPASS_OBJS) $(XLIBS)

make-ssh-known-hosts: make-ssh-known-hosts.pl
	-rm -f make-ssh-known-hosts
	sed "s#&PERL&#$(PERL)#" <$(srcdir)/make-ssh-known-hosts.pl >make-ssh-known-hosts
	chmod +x make-ssh-known-hosts

gen_minfd: $(GEN_MINFD_OBJS)
	$(CC) $(LDFLAGS) -o gen_minfd $(GEN_MINFD_OBJS)

minfd.o: minfd.h
minfd.h: gen_minfd
	rm -f minfd.h minfd.h~
	./gen_minfd $(USER_SHELLS) > minfd.h~
	mv -f minfd.h~ minfd.h

GMP_COPY_SOURCES = mpz_gcd.c mpz_powm.c mpz_pow_ui.c mpz_add.c mpz_sub.c \
		mpz_mul.c mpz_cmp.c mpz_sqrtrem.c
$(GMPDIR)/libgmp.a:
	-if test '!' -d $(GMPDIR); then \
	  mkdir $(GMPDIR); mkdir $(GMPDIR)/tests; \
	  cp $(srcdir)/$(GMPDIR)/Makefile $(GMPDIR); \
	  cp $(srcdir)/$(GMPDIR)/cre-*.c $(GMPDIR); \
	  cp $(srcdir)/$(GMPDIR)/tests/Makefile $(GMPDIR)/tests; \
	  for i in $(GMP_COPY_SOURCES); do \
	    cp $(srcdir)/$(GMPDIR)/$$i $(GMPDIR); done; \
	fi
	cd $(GMPDIR); $(MAKE) VPATH=$(srcdir)/$(GMPDIR):../$(srcdir)/$(GMPDIR)\
              CC="$(CC)" CFLAGS="$(CFLAGS) -I. -I$(srcdir)/$(GMPDIR) \
	       -I../$(srcdir)/$(GMPDIR)" RANLIB="$(RANLIB)"

$(ZLIBDEP):
	-if test '!' -d $(ZLIBDIR); then \
	  mkdir $(ZLIBDIR); \
	  cp $(srcdir)/$(ZLIBDIR)/Makefile $(ZLIBDIR); \
	fi
	cd $(ZLIBDIR); $(MAKE) VPATH=$(srcdir)/$(ZLIBDIR):../$(srcdir)/$(ZLIBDIR) \
	  CC="$(CC)" CFLAGS="$(CFLAGS) -I. -I$(srcdir)/$(ZLIBDIR) \
	    -I../$(srcdir)/$(GMPDIR)" RANLIB="$(RANLIB)" libz.a

$(RSAREFSRCDIR)/librsaref.a:
	-if test '!' -d $(RSAREFDIR); then \
	  (cd $(srcdir); tar cf - $(RSAREFSRCDIR)) | tar xf -; fi
	cd $(RSAREFSRCDIR); $(MAKE) -f ../../Makefile librsaref.a

RSAREFSRCS = desc.c digit.c md2c.c md5c.c nn.c prime.c r_dh.c r_encode.c \
	r_enhanc.c r_keygen.c r_random.c r_stdlib.c rsa.c

# Note: this target is used in a recursive make, with VPATH pointing to source
librsaref.a:
	for i in $(RSAREFSRCS); do $(CC) $(CFLAGS) -c $$i; done
	$(AR) rc librsaref.a $(RSAREFSRCS:.c=.o)
	$(RANLIB) librsaref.a

# Creates /etc/ssh_host_key
generate-host-key:
	-@if test -f $(install_prefix)$(HOST_KEY_FILE); \
          then echo "You already have a host key in $(install_prefix)$(HOST_KEY_FILE)."; \
	  else \
	    umask 022; echo "Generating 1024 bit host key."; \
	    ./ssh-keygen -b 1024 -f $(install_prefix)$(HOST_KEY_FILE) -N ''; \
	  fi

# Creates install directories
make-dirs:
	-umask 022; if test '!' -d $(install_prefix)$(prefix); then \
	  mkdir $(install_prefix)$(prefix); fi; \
	if test '!' -d $(install_prefix)$(exec_prefix); then \
	  mkdir $(install_prefix)$(exec_prefix); fi; \
	if test '!' -d $(install_prefix)$(etcdir); then \
	  mkdir $(install_prefix)$(etcdir); fi; \
	if test '!' -d $(install_prefix)$(bindir); then \
	  mkdir $(install_prefix)$(bindir); fi; \
	if test '!' -d $(install_prefix)$(sbindir); then \
	  mkdir $(install_prefix)$(sbindir); fi; \
	if test '!' -d $(install_prefix)$(mandir); then \
	  mkdir $(install_prefix)$(mandir); fi; \
	if test '!' -d $(install_prefix)$(man1dir); then \
	  mkdir $(install_prefix)$(man1dir); fi; \
	if test '!' -d $(install_prefix)$(man8dir); then \
	  mkdir $(install_prefix)$(man8dir); fi

# This target can be used to install the host key and configuration files on
# other machines in a networked environment after the binaries have first
# been installed on one machine into a common binary directory.
hostinstall: $(PROGRAMS) make-dirs generate-host-key install-configs

# Ssh is preferably installed suid root.  It can also be used non-root,
# but then it cannot connect from a privileged socket, and rhosts
# authentication will be disabled.
#
# Sshd is not suid root, but should preferably be run as root
# (otherwise it can only log in as the user it runs as, and must be
# bound to a non-privileged port).  Also, password authentication may
# not be available if non-root and using shadow passwords.
install: $(PROGRAMS) make-dirs generate-host-key install-configs
	$(INSTALL_PROGRAM) -o root -m 04711 ssh $(install_prefix)$(bindir)/ssh
	-if test "`echo ssh | sed '$(transform)'`" '!=' ssh; then \
	  rm -f $(install_prefix)$(bindir)/`echo ssh | sed '$(transform)'`; \
	  $(LN_S) ssh \
	    $(install_prefix)$(bindir)/`echo ssh | sed '$(transform)'`; fi
	rm -f $(install_prefix)$(bindir)/slogin
	$(LN_S) ssh $(install_prefix)$(bindir)/slogin
	-if test "`echo slogin | sed '$(transform)'`" '!=' slogin; then \
	  rm -f $(install_prefix)$(bindir)/`echo slogin | sed '$(transform)'`;\
	  $(LN_S) ssh \
	    $(install_prefix)$(bindir)/`echo slogin | sed '$(transform)'`; fi
	-for p in $(NORMAL_PROGRAMS); do \
	  $(INSTALL_PROGRAM) -m 0755 $$p $(install_prefix)$(bindir)/$$p; \
	  if test "`echo $$p | sed '$(transform)'`" '!=' $$p; then \
	    rm -f $(install_prefix)$(bindir)/`echo $$p | sed '$(transform)'`; \
	    $(LN_S) $$p \
	      $(install_prefix)$(bindir)/`echo $$p | sed '$(transform)'`; fi; \
	done
	-for p in $(SCRIPT_PROGRAMS); do \
	  $(INSTALL_DATA) $$p $(install_prefix)$(bindir)/$$p; \
	  chmod 755 $(install_prefix)$(bindir)/$$p; \
	  if test "`echo $$p | sed '$(transform)'`" '!=' $$p; then \
	    rm -f $(install_prefix)$(bindir)/`echo $$p | sed '$(transform)'`; \
	    $(LN_S) $$p \
	      $(install_prefix)$(bindir)/`echo $$p | sed '$(transform)'`; fi; \
	done
	-rm -f $(install_prefix)$(bindir)/`echo sshd | sed '$(transform)'`
	-for p in $(SBIN_PROGRAMS); do \
	  $(INSTALL_PROGRAM) -m 0755 $$p $(install_prefix)$(sbindir)/$$p; \
	  if test "`echo $$p | sed '$(transform)'`" '!=' $$p; then \
	    rm -f $(install_prefix)$(sbindir)/`echo $$p | sed '$(transform)'`;\
	    $(LN_S) $$p \
	      $(install_prefix)$(sbindir)/`echo $$p | sed '$(transform)'`; fi;\
	done
	-for p in $(MAN1PAGES); do \
	  $(INSTALL_DATA) -m 0644 $(srcdir)/$$p $(install_prefix)$(man1dir)/$$p ; \
	  if test "`echo $$p | sed '$(transform)'`" '!=' $$p; then \
	    rm -f $(install_prefix)$(man1dir)/`echo $$p | sed '$(transform)'`;\
	    $(LN_S) $$p \
	      $(install_prefix)$(man1dir)/`echo $$p | sed '$(transform)'`; \
	  fi; \
	done
	rm -f $(install_prefix)$(man1dir)/slogin.1
	$(LN_S) ssh.1 $(install_prefix)$(man1dir)/slogin.1
	-if test "`echo slogin.1 | sed '$(transform)'`" '!=' slogin.1; then \
	  rm -f $(install_prefix)$(man1dir)/`echo slogin.1 | sed '$(transform)'`;\
	  $(LN_S) ssh.1 \
	    $(install_prefix)$(man1dir)/`echo slogin.1 | sed '$(transform)'`; \
	fi
	-for p in $(MAN1GENERATED); do \
	  $(INSTALL_DATA) -m 0644 $$p $(install_prefix)$(man1dir)/$$p ; \
	  if test "`echo $$p | sed '$(transform)'`" '!=' $$p; then \
	    rm -f $(install_prefix)$(man1dir)/`echo $$p | sed '$(transform)'`;\
	    $(LN_S) $$p \
	      $(install_prefix)$(man1dir)/`echo $$p | sed '$(transform)'`; \
	  fi; \
	done
	-for p in $(MAN8GENERATED); do \
	  $(INSTALL_DATA) -m 0644 $$p $(install_prefix)$(man8dir)/$$p; \
	  if test "`echo $$p | sed '$(transform)'`" '!=' $$p; then \
	    rm -f $(install_prefix)$(man8dir)/`echo $$p | sed '$(transform)'`;\
	    $(LN_S) $$p \
	      $(install_prefix)$(man8dir)/`echo $$p | sed '$(transform)'`; fi;\
	done

install-configs:
	-if test '!' -f $(install_prefix)$(HOST_CONFIG_FILE); then \
	  $(INSTALL_DATA) -m 0644 $(srcdir)/host_config.sample \
	    $(install_prefix)$(HOST_CONFIG_FILE); fi
	-if test '!' -f $(install_prefix)$(SERVER_CONFIG_FILE); then \
	  cat $(srcdir)/server_config.sample | \
	  sed "s#_ETCDIR_#$(etcdir)#g" >/tmp/ssh_inst.$$$$; \
	  $(INSTALL_DATA) -m 0644 /tmp/ssh_inst.$$$$ \
	    $(install_prefix)$(SERVER_CONFIG_FILE); \
	  rm -f /tmp/ssh_inst.$$$$; fi

uninstall:
	for p in ssh $(NORMAL_PROGRAMS) $(SCRIPT_PROGRAMS); do \
	  rm -f $(install_prefix)$(bindir)/$$p; \
	  rm -f $(install_prefix)$(bindir)/`echo $$p | sed '$(transform)'`; \
	done
	for p in $(SBIN_PROGRAMS); do \
	  rm -f $(install_prefix)$(sbindir)/$$p; \
	  rm -f $(install_prefix)$(sbindir)/`echo $$p | sed '$(transform)'`; \
	done
	rm -f $(install_prefix)$(bindir)/slogin
	rm -f $(install_prefix)$(bindir)/`echo slogin | sed '$(transform)'`
	for p in $(MAN1PAGES) $(MAN1GENERATED); do \
	  rm -f $(install_prefix)$(man1dir)/$$p; \
	  rm -f $(install_prefix)$(man1dir)/`echo $$p | sed '$(transform)'`; \
	done
	rm -f $(install_prefix)$(man1dir)/slogin.1
	rm -f $(install_prefix)$(man1dir)/`echo slogin.1 | sed '$(transform)'`
	for p in $(MAN8GENERATED); do \
	  rm -f $(install_prefix)$(man8dir)/$$p; \
	  rm -f $(install_prefix)$(man8dir)/`echo $$p | sed '$(transform)'`; \
	done

clean:
	-rm -f *.o minfd.h gmon.out *core $(PROGRAMS) gen_minfd rfc-pg
	cd $(GMPDIR); $(MAKE) clean
#	cd $(RSAREFSRCDIR); rm -f *.o *.a
	cd $(ZLIBDIR); $(MAKE) clean

distclean: clean
	-rm -f Makefile config.status config.cache config.log config.h
	-rm -f ssh.1 sshd.8 make-ssh-known-hosts.1
	cd $(GMPDIR); $(MAKE) clean
	cd $(ZLIBDIR); $(MAKE) clean

dist:
	-rm -rf $(DISTNAME)
	-mkdir $(DISTNAME)
	cp $(DISTFILES) $(DISTNAME)
	-rm $(DISTNAME)/config.h
	tar cf - $(GMPDIR) | (cd $(DISTNAME); tar xf -)
	cd $(DISTNAME)/$(GMPDIR); $(MAKE) clean
#	tar cf - $(RSAREFDIR) | (cd $(DISTNAME); tar xf -)
#	cd $(DISTNAME)/$(RSAREFSRCDIR); rm -f *.o *.a
	tar cf - $(ZLIBDIR) | (cd $(DISTNAME); tar xf -)
	cd $(DISTNAME)/$(ZLIBDIR); rm -f *.o *.a
	tar cf $(DISTNAME).tar $(DISTNAME)
	-rm -f $(DISTNAME).tar.gz
	gzip $(DISTNAME).tar
	rm -rf $(DISTNAME)
	@echo Distribution left in $(DISTNAME).tar.gz
	@echo Incrementing version number...
	@old_version=`sed 's/.*\.\([0-9][0-9]*\)"$$/\1/' version.h`; \
	 new_version=`expr $$old_version + 1`; \
	 (echo "s/\.$$old_version\"/.$$new_version\"/g"; echo w; echo q) | ed version.h >/dev/null

depend:
	$(MAKEDEP) -I$(srcdir) -I. -I$(GMPDIR) -I$(ZLIBDIR) $(DEFS) $(SRCS)
