4 exec_prefix=@exec_prefix@
7 libexecdir=@libexecdir@
11 sysconfdir=$$GLOBUS_LOCATION/etc/ssh
14 top_srcdir=@top_srcdir@
18 SSH_PROGRAM=@bindir@/ssh
19 ASKPASS_PROGRAM=$(libexecdir)/ssh-askpass
20 SFTP_SERVER=$(libexecdir)/sftp-server
25 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
34 XAUTH_PATH=@XAUTH_PATH@
35 LDFLAGS=-L. -Lopenbsd-compat/ @LDFLAGS@
39 INSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@
40 INSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@
42 @NO_SFTP@SFTP_PROGS=sftp-server$(EXEEXT) sftp$(EXEEXT)
44 TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-agent$(EXEEXT) scp$(EXEEXT) ssh-rand-helper${EXEEXT} $(SFTP_PROGS)
46 LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o dh.o dispatch.o fatal.o mac.o hostfile.o key.o kex.o kexdh.o kexgex.o log.o match.o misc.o mpaux.o nchan.o packet.o pathnames.o radix.o rijndael.o entropy.o readpass.o rsa.o scard.o ssh-dss.o ssh-rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o kexgss.o gss-genr.o
48 SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o sshtty.o readconf.o clientloop.o
50 SSHDOBJS= sshd.o auth.o auth1.o auth2.o auth-chall.o auth2-chall.o auth-rhosts.o auth-options.o auth-krb4.o auth-krb5.o auth-pam.o auth2-pam.o auth-passwd.o auth-rsa.o auth-rh-rsa.o auth-sia.o sshpty.o sshlogin.o loginrec.o servconf.o serverloop.o md5crypt.o session.o groupaccess.o auth-skey.o auth-bsdauth.o gss-serv.o
52 MANPAGES = 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
53 MANPAGES_IN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1
56 CONFIGFILES=sshd_config.out ssh_config.out moduli.out
57 CONFIGFILES_IN=sshd_config ssh_config moduli
60 -D/etc/ssh/ssh_config='$(sysconfdir)'/ssh_config \
61 -D/etc/ssh/ssh_known_hosts='$(sysconfdir)'/ssh_known_hosts \
62 -D/etc/ssh/sshd_config='$(sysconfdir)'/sshd_config \
63 -D/usr/libexec=$(libexecdir) \
64 -D/etc/shosts.equiv='$(sysconfdir)'/shosts.equiv \
65 -D/etc/ssh/ssh_host_key='$(sysconfdir)'/ssh_host_key \
66 -D/etc/ssh/ssh_host_dsa_key='$(sysconfdir)'/ssh_host_dsa_key \
67 -D/etc/ssh/ssh_host_rsa_key='$(sysconfdir)'/ssh_host_rsa_key \
68 -D/var/run/sshd.pid=$(piddir)/sshd.pid \
69 -D/etc/ssh/moduli='$(sysconfdir)'/moduli \
70 -D/etc/ssh/sshrc='$(sysconfdir)'/sshrc \
71 -D/usr/X11R6/bin/xauth=$(XAUTH_PATH) \
72 -D/usr/bin:/bin:/usr/sbin:/sbin=@user_path@
74 FIXPATHSCMD = $(PERL) $(srcdir)/fixpaths $(PATHSUBS)
76 all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
78 gpt-all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)
80 $(LIBSSH_OBJS): config.h
85 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
87 LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
89 (cd openbsd-compat && $(MAKE))
92 libssh.a: $(LIBSSH_OBJS)
93 $(AR) rv $@ $(LIBSSH_OBJS)
96 ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
97 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
99 sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
100 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBS)
102 scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o
103 $(LD) -o $@ scp.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
105 ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
106 $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
108 ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o
109 $(LD) -o $@ ssh-agent.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
111 ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
112 $(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
114 ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
115 $(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
117 sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o
118 $(LD) -o $@ sftp-server.o sftp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
120 sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-int.o sftp-common.o sftp-glob.o
121 $(LD) -o $@ sftp.o sftp-client.o sftp-common.o sftp-int.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
123 ssh-rand-helper${EXEEXT}: $(LIBCOMPAT) libssh.a ssh-rand-helper.o
124 $(LD) -o $@ ssh-rand-helper.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
126 # test driver for the loginrec code - not built by default
127 logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
128 $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
130 $(MANPAGES): $(MANPAGES_IN)
131 if test "$(MANTYPE)" = "cat"; then \
132 manpage=$(srcdir)/`echo $@ | sed 's/\.[1-9]\.out$$/\.0/'`; \
134 manpage=$(srcdir)/`echo $@ | sed 's/\.out$$//'`; \
136 if test "$(MANTYPE)" = "man"; then \
137 $(FIXPATHSCMD) $${manpage} | $(PERL) $(srcdir)/mdoc2man.pl > $@; \
139 $(FIXPATHSCMD) $${manpage} > $@; \
142 $(CONFIGFILES): $(CONFIGFILES_IN)
143 conffile=`echo $@ | sed 's/.out$$//'`; \
144 $(FIXPATHSCMD) $(srcdir)/$${conffile} > $@
147 rm -f *.o *.a $(TARGETS) logintest config.cache config.log
149 (cd openbsd-compat && $(MAKE) clean)
152 rm -f *.o *.a $(TARGETS) logintest config.cache config.log
154 rm -f Makefile config.h config.status ssh_prng_cmds *~
155 rm -rf autom4te.cache
156 (cd openbsd-compat && $(MAKE) distclean)
157 (cd scard && $(MAKE) distclean)
160 rm -f configure config.h.in *.0
161 rm -f *.o *.a $(TARGETS) logintest config.cache config.log
163 rm -f Makefile config.h config.status ssh_prng_cmds *~
164 (cd openbsd-compat && $(MAKE) distclean)
165 (cd scard && $(MAKE) distclean)
170 @for f in $(MANPAGES_IN) ; do \
171 base=`echo $$f | sed 's/\..*$$//'` ; \
172 echo "$$f -> $$base.0" ; \
173 nroff -mandoc $$f | cat -v | sed -e 's/.\^H//g' \
179 (cd scard && $(MAKE) -f Makefile.in distprep)
181 install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files host-key
182 install-nokeys: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files
184 gpt-install: gpt-all install-files
185 gpt-install-nokeys: gpt-all install-files
188 (cd scard && $(MAKE) DESTDIR=$(DESTDIR) install)
190 install-files: scard-install
191 $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
192 $(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
193 $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
194 $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)
195 $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
196 $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
197 $(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
198 $(INSTALL) -m $(SSH_MODE) -s ssh $(DESTDIR)$(bindir)/ssh
199 $(INSTALL) -m 0755 -s scp $(DESTDIR)$(bindir)/scp
200 $(INSTALL) -m 0755 -s ssh-add $(DESTDIR)$(bindir)/ssh-add
201 $(INSTALL) -m 0755 -s ssh-agent $(DESTDIR)$(bindir)/ssh-agent
202 $(INSTALL) -m 0755 -s ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen
203 $(INSTALL) -m 0755 -s ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan
204 $(INSTALL) -m 0755 -s sshd $(DESTDIR)$(sbindir)/sshd
205 if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \
206 $(INSTALL) -m 0755 -s ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \
208 @NO_SFTP@$(INSTALL) -m 0755 -s sftp $(DESTDIR)$(bindir)/sftp
209 @NO_SFTP@$(INSTALL) -m 0755 -s sftp-server $(DESTDIR)$(SFTP_SERVER)
210 $(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
211 $(INSTALL) -m 644 scp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
212 $(INSTALL) -m 644 ssh-add.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
213 $(INSTALL) -m 644 ssh-agent.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
214 $(INSTALL) -m 644 ssh-keygen.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
215 $(INSTALL) -m 644 ssh-keyscan.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
216 $(INSTALL) -m 644 sshd.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
217 @NO_SFTP@$(INSTALL) -m 644 sftp.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
218 @NO_SFTP@$(INSTALL) -m 644 sftp-server.8.out $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
219 -rm -f $(DESTDIR)$(bindir)/slogin
220 ln -s ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
221 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
222 ln -s ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
223 if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
224 $(srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir); \
226 if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_config ]; then \
227 $(INSTALL) -m 644 ssh_config.out $(DESTDIR)$(sysconfdir)/ssh_config; \
229 echo "$(DESTDIR)$(sysconfdir)/ssh_config already exists, install will not overwrite"; \
231 if [ ! -f $(DESTDIR)$(sysconfdir)/sshd_config ]; then \
232 $(INSTALL) -m 644 sshd_config.out $(DESTDIR)$(sysconfdir)/sshd_config; \
234 echo "$(DESTDIR)$(sysconfdir)/sshd_config already exists, install will not overwrite"; \
236 if [ -f ssh_prng_cmds -a ! -z "$(INSTALL_SSH_PRNG_CMDS)" ]; then \
237 $(PERL) $(srcdir)/fixprogs ssh_prng_cmds $(ENT); \
238 if [ ! -f $(DESTDIR)$(sysconfdir)/ssh_prng_cmds ] ; then \
239 $(INSTALL) -m 644 ssh_prng_cmds.out $(DESTDIR)$(sysconfdir)/ssh_prng_cmds; \
241 echo "$(DESTDIR)$(sysconfdir)/ssh_prng_cmds already exists, install will not overwrite"; \
244 if [ ! -f $(DESTDIR)$(sysconfdir)/moduli ]; then \
245 if [ -f $(DESTDIR)$(sysconfdir)/primes ]; then \
246 echo "moving $(DESTDIR)$(sysconfdir)/primes to $(DESTDIR)$(sysconfdir)/moduli"; \
247 mv "$(DESTDIR)$(sysconfdir)/primes" "$(DESTDIR)$(sysconfdir)/moduli"; \
249 $(INSTALL) -m 644 moduli.out $(DESTDIR)$(sysconfdir)/moduli; \
252 echo "$(DESTDIR)$(sysconfdir)/moduli already exists, install will not overwrite"; \
256 $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
257 $(srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
258 $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
259 $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)
260 $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)1
261 $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/$(mansubdir)8
262 $(srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)
263 $(INSTALL) -m $(SSH_MODE) -s ssh $(DESTDIR)$(bindir)/ssh
264 $(INSTALL) -m 0755 -s scp $(DESTDIR)$(bindir)/scp.real
265 $(INSTALL) -m 0755 scp.wrapper $(DESTDIR)$(bindir)/scp
266 $(INSTALL) -m 0755 -s ssh-add $(DESTDIR)$(bindir)/ssh-add
267 $(INSTALL) -m 0755 -s ssh-agent $(DESTDIR)$(bindir)/ssh-agent
268 $(INSTALL) -m 0755 -s ssh-keygen $(DESTDIR)$(bindir)/ssh-keygen
269 $(INSTALL) -m 0755 -s ssh-keyscan $(DESTDIR)$(bindir)/ssh-keyscan
270 $(INSTALL) -m 0755 -s sshd $(DESTDIR)$(sbindir)/sshd
271 if test ! -z "$(INSTALL_SSH_RAND_HELPER)" ; then \
272 $(INSTALL) -m 0755 -s ssh-rand-helper $(DESTDIR)$(libexecdir)/ssh-rand-helper ; \
274 $(INSTALL) -m 644 ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
275 $(INSTALL) -m 644 scp.1 $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
276 $(INSTALL) -m 644 ssh-add.1 $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
277 $(INSTALL) -m 644 ssh-agent.1 $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
278 $(INSTALL) -m 644 ssh-keygen.1 $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
279 $(INSTALL) -m 644 ssh-keyscan.1 $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
280 $(INSTALL) -m 644 sshd.8 $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
281 @NO_SFTP@$(INSTALL) -m 644 sftp.1 $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
282 @NO_SFTP@$(INSTALL) -m 644 sftp-server.8 $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
283 @NO_SFTP@$(INSTALL) -m 0755 -s sftp $(DESTDIR)$(bindir)/sftp.real
284 @NO_SFTP@$(INSTALL) -m 0755 sftp.wrapper $(DESTDIR)$(bindir)/sftp
285 @NO_SFTP@$(INSTALL) -m 0755 -s sftp-server $(DESTDIR)$(SFTP_SERVER)
286 -rm -f $(DESTDIR)$(bindir)/slogin
287 ln -s ssh$(EXEEXT) $(DESTDIR)$(bindir)/slogin
288 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
289 ln -s ssh.1 $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1
291 host-key: ssh-keygen$(EXEEXT)
292 if [ -z "$(DESTDIR)" ] ; then \
293 if [ -f "$(DESTDIR)$(sysconfdir)/ssh_host_key" ] ; then \
294 echo "$(DESTDIR)$(sysconfdir)/ssh_host_key already exists, skipping." ; \
296 ./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N "" ; \
298 if [ -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key ] ; then \
299 echo "$(DESTDIR)$(sysconfdir)/ssh_host_dsa_key already exists, skipping." ; \
301 ./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N "" ; \
303 if [ -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key ] ; then \
304 echo "$(DESTDIR)$(sysconfdir)/ssh_host_rsa_key already exists, skipping." ; \
306 ./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N "" ; \
310 host-key-force: ssh-keygen$(EXEEXT)
311 ./ssh-keygen -t rsa1 -f $(DESTDIR)$(sysconfdir)/ssh_host_key -N ""
312 ./ssh-keygen -t dsa -f $(DESTDIR)$(sysconfdir)/ssh_host_dsa_key -N ""
313 ./ssh-keygen -t rsa -f $(DESTDIR)$(sysconfdir)/ssh_host_rsa_key -N ""
315 uninstallall: uninstall
316 -rm -f $(DESTDIR)$(sysconfdir)/ssh_config
317 -rm -f $(DESTDIR)$(sysconfdir)/sshd_config
318 -rm -f $(DESTDIR)$(sysconfdir)/ssh_prng_cmds
319 -rmdir $(DESTDIR)$(sysconfdir)
320 -rmdir $(DESTDIR)$(bindir)
321 -rmdir $(DESTDIR)$(sbindir)
322 -rmdir $(DESTDIR)$(mandir)/$(mansubdir)1
323 -rmdir $(DESTDIR)$(mandir)/$(mansubdir)8
324 -rmdir $(DESTDIR)$(mandir)
325 -rmdir $(DESTDIR)$(libexecdir)
328 -rm -f $(DESTDIR)$(bindir)/slogin
329 -rm -f $(DESTDIR)$(bindir)/ssh$(EXEEXT)
330 -rm -f $(DESTDIR)$(bindir)/scp$(EXEEXT)
331 -rm -f $(DESTDIR)$(bindir)/ssh-add$(EXEEXT)
332 -rm -f $(DESTDIR)$(bindir)/ssh-agent$(EXEEXT)
333 -rm -f $(DESTDIR)$(bindir)/ssh-keygen$(EXEEXT)
334 -rm -f $(DESTDIR)$(bindir)/ssh-keyscan$(EXEEXT)
335 -rm -f $(DESTDIR)$(bindir)/sftp$(EXEEXT)
336 -rm -f $(DESTDIR)$(sbindir)/sshd$(EXEEXT)
337 -rm -r $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
338 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
339 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/scp.1
340 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-add.1
341 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-agent.1
342 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keygen.1
343 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/sftp.1
344 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/ssh-keyscan.1
345 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sshd.8
346 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)8/sftp-server.8
347 -rm -f $(DESTDIR)$(mandir)/$(mansubdir)1/slogin.1