Makefile.in 11.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# LSH Makefile

@SET_MAKE@

srcdir = @srcdir@
VPATH = @srcdir@

top_srcdir = @top_srcdir@

LIBOBJS = @LIBOBJS@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = $(INSTALL_PROGRAM) -s
MKDIR_P = @MKDIR_P@

19
SUBDIRS = testsuite
20 21 22

include config.make

Niels Möller's avatar
Niels Möller committed
23 24
include $(srcdir)/.dist_classes
include $(srcdir)/.dist_headers
25

26 27 28 29
# The *_builddir directories, if they exist at all, are symlinks
# created by the configure script.
PRE_CPPFLAGS = -I. -Iargp_builddir -Inettle_builddir -Ispki_builddir
PRE_LDFLAGS = -Largp_builddir -Lnettle_builddir -Lspki_builddir
30 31 32

SCHEME = $(SCHEME_PROGRAM) -l $(srcdir)/scm/$(SCHEME_NAME)-compat.scm

33
# Missing: @KRB_PROGRAM@ @PAM_PROGRAM@
34

35
BIN_PROGRAMS = lsh$(EXEEXT) \
36
	       lsh-keygen$(EXEEXT) lsh-decrypt-key$(EXEEXT) \
37
	       lsh-decode-key$(EXEEXT) lsh-export-key$(EXEEXT) lsh-make-seed$(EXEEXT)
38

39
SBIN_PROGRAMS = lshd$(EXEEXT)
40

41 42 43 44 45
LIBEXEC_PROGRAMS = lsh-transport$(EXEEXT) \
		   lshd-userauth$(EXEEXT) lshd-connection$(EXEEXT) \
		   lshd-pty-helper$(EXEEXT)

TARGETS = $(BIN_PROGRAMS) $(SBIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
46

Niels Möller's avatar
Niels Möller committed
47 48
SCRIPTS = lsh-authorize ssh-conv lsh-upgrade lsh-upgrade-key lcp lshg

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
generated_sources = atoms_defines.h atoms_gperf.c atoms_table.c \
	packet_types.h

all check:
	$(MAKE) $@-here
	set -e; for d in $(SUBDIRS); do \
	  echo "Making $@ in $$d" ; (cd $$d && $(MAKE) $@); done

clean distclean mostlyclean maintainer-clean tags:
	set -e; for d in $(SUBDIRS); do \
	  echo "Making $@ in $$d" ; (cd $$d && $(MAKE) $@); done
	$(MAKE) $@-here

check-here:
	true

.PHONY: bootstrap
bootstrap: $(generated_sources) $(dist_classes) 

# FIXME: Probably breaks parallel builds; before the first compilation,
# make doesn't know about the dependencies on environ.h and the files
# created by the bootstrap target.
all-here: bootstrap environ.h $(TARGETS)

73
# queue.c not really used by all programs
74 75 76 77 78 79 80 81 82 83
COMMON_SOURCES = atoms.c \
		 alist.c \
		 charset.c \
		 gc.c \
		 io.c \
		 list.c \
		 resource.c \
		 service_read.c \
		 ssh_read.c \
		 ssh_write.c \
84
		 queue.c \
85 86
		 xalloc.c

87
INTERACT_SOURCES = interact.c unix_interact.c
88
INTERACT_RANDOM_SOURCES = unix_random_user.c
89

Niels Möller's avatar
Niels Möller committed
90 91 92
TTY_SOURCES = tty.c

# FIXME pkcs5.c doesn't quite belong here, it's used only on the client side.
Niels Möller's avatar
Niels Möller committed
93
# And compress.c shold be needed only when we have zlib support.
Niels Möller's avatar
Niels Möller committed
94
CRYPTO_SOURCES = algorithms.c \
Niels Möller's avatar
Niels Möller committed
95
		 compress.c \
Niels Möller's avatar
Niels Möller committed
96 97 98 99
		 crypto.c \
		 dsa.c \
		 pkcs5.c \
		 rsa.c \
100
		 seed_file.c \
Niels Möller's avatar
Niels Möller committed
101 102 103 104
		 sexp.c \
		 spki.c \
		 unix_random.c \

105 106 107
# Decryption of private keys not needed on the server side.
CRYPTO_CLIENT_SOURCES = spki-decrypt.c

108 109 110 111 112 113 114 115
TRANSPORT_SOURCES = dh_exchange.c \
		    encrypt.c \
		    keyexchange.c \
		    transport.c \
		    transport_forward.c \
		    transport_read.c \
		    transport_write.c

Niels Möller's avatar
Niels Möller committed
116 117 118 119 120 121 122 123 124 125 126
CONNECTION_SOURCES = channel.c \
		     channel_forward.c \
		     channel_io.c \
		     connection.c \
		     reaper.c \
		     tcpforward.c

SERVER_SOURCES = server.c \
		 server_config.c \
		 tokenize_config.c

127 128
pty_helper_SOURCES = pty-helper.c

129 130 131 132 133 134
lsh_SOURCES = arglist.c \
	      client.c \
	      client_escape.c \
	      client_pty.c \
	      client_session.c \
	      client_tcpforward.c \
135
	      client_x11.c \
136 137
	      gateway.c \
	      gateway_channel.c \
138
	      gateway_tcpforward.c \
139
	      gateway_x11.c \
140
	      lsh.c \
141
	      socks.c
142

Niels Möller's avatar
Niels Möller committed
143 144 145
lsh_transport_SOURCES = client_keyexchange.c \
			lsh-transport.c

146 147 148 149
lsh_keygen_SOURCES = lsh-keygen.c

lsh_decrypt_key_SOURCES = lsh-decrypt-key.c

150 151 152 153 154 155
lsh_decode_key_SOURCES = lsh-decode-key.c

lsh_export_key_SOURCES = lsh-export-key.c

lsh_make_seed_SOURCES = lsh-make-seed.c

Niels Möller's avatar
Niels Möller committed
156 157 158 159 160 161 162 163 164 165
lshd_SOURCES = daemon.c \
	       lshd.c \
	       server_keyexchange.c

lshd_userauth_SOURCES = lshd-userauth.c

lshd_connection_SOURCES = lshd-connection.c \
			  server_pty.c \
			  server_session.c \
			  server_tcpforward.c \
166
 			  server_x11.c \
Niels Möller's avatar
Niels Möller committed
167 168 169
			  translate_signal.c \
			  unix_process.c

170 171
lshd_pty_helper_SOURCES = lshd-pty-helper.c

Niels Möller's avatar
Niels Möller committed
172
SPECIAL_SOURCES = format.c lsh_string.c parse.c werror.c
173

Niels Möller's avatar
Niels Möller committed
174
SOURCES = $(COMMON_SOURCES) $(SPECIAL_SOURCES) \
175 176
	  $(CRYPTO_SOURCES) $(CRYPTO_CLIENT_SOURCES) \
	  $(TRANSPORT_SOURCES) $(CONNECTION_SOURCES) \
177 178
	  $(SERVER_SOURCES) $(INTERACT_SOURCES) $(INTERACT_RANDOM_SOURCES) \
	  $(TTY_SOURCES) \
179
	  $(lsh_SOURCES) $(lsh_transport_SOURCES) \
180
	  $(lsh_keygen_SOURCES) $(lsh_decrypt_key_SOURCES) \
Niels Möller's avatar
Niels Möller committed
181
	  $(lsh_decode_key_SOURCES) $(lsh_export_key_SOURCES) $(lsh_make_seed_SOURCES) \
182 183
	  $(lshd_SOURCES) $(lshd_userauth_SOURCES) $(lshd_connection_SOURCES) \
	  $(pty_helper_SOURCES) $(lshd_pty_helper_SOURCES)
184

Niels Möller's avatar
Niels Möller committed
185 186 187 188
DISTFILES = $(SOURCES) $(HEADERS) $(SCRIPTS) \
	    .dist_headers $(dist_headers) .dist_classes $(dist_classes) \
	    atoms.in environ.h.in process_atoms invert-defs $(generated_sources) \
	    config.h.in Makefile.in config.make.in 
189

Niels Möller's avatar
Niels Möller committed
190 191
SPECIAL_OBJS = $(SPECIAL_SOURCES:.c=.$(OBJEXT))
MINIMAL_OBJS = $(SPECIAL_SOURCES:.c=.m$(OBJEXT))
192 193 194

COMMON_OBJS = $(COMMON_SOURCES:.c=.$(OBJEXT))
INTERACT_OBJS = $(INTERACT_SOURCES:.c=.$(OBJEXT))
195
INTERACT_RANDOM_OBJS = $(INTERACT_RANDOM_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
196 197
TTY_OBJS = $(TTY_SOURCES:.c=.$(OBJEXT))
CRYPTO_OBJS = $(CRYPTO_SOURCES:.c=.$(OBJEXT))
198
CRYPTO_CLIENT_OBJS = $(CRYPTO_CLIENT_SOURCES:.c=.$(OBJEXT))
199
TRANSPORT_OBJS = $(TRANSPORT_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
200 201
CONNECTION_OBJS = $(CONNECTION_SOURCES:.c=.$(OBJEXT))
SERVER_OBJS = $(SERVER_SOURCES:.c=.$(OBJEXT))
202
pty_helper_OBJS = $(pty_helper_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
203

204
lsh_OBJS = $(lsh_SOURCES:.c=.$(OBJEXT)) \
Niels Möller's avatar
Niels Möller committed
205
	   $(COMMON_OBJS) $(MINIMAL_OBJS) $(INTERACT_OBJS) $(TTY_OBJS) $(CONNECTION_OBJS)
206

207
lsh_transport_OBJS = $(lsh_transport_SOURCES:.c=.$(OBJEXT)) \
208 209
		     $(COMMON_OBJS) $(SPECIAL_OBJS) \
		     $(INTERACT_OBJS) $(INTERACT_RANDOM_OBJS) \
210
		     $(CRYPTO_OBJS) $(CRYPTO_CLIENT_OBJS) $(TRANSPORT_OBJS)
211 212

lsh_keygen_OBJS = $(lsh_keygen_SOURCES:.c=.$(OBJEXT)) \
213 214 215
		  $(COMMON_OBJS) $(SPECIAL_OBJS) \
		  $(INTERACT_OBJS) $(INTERACT_RANDOM_OBJS) \
		  $(CRYPTO_OBJS)
216 217

lsh_decrypt_key_OBJS = $(lsh_decrypt_key_SOURCES:.c=.$(OBJEXT)) \
218 219
		       $(COMMON_OBJS) $(SPECIAL_OBJS) $(INTERACT_OBJS) \
		       $(CRYPTO_OBJS) $(CRYPTO_CLIENT_OBJS)
220

221 222 223 224 225 226 227 228 229 230 231
lsh_decode_key_OBJS = $(lsh_decode_key_SOURCES:.c=.$(OBJEXT)) \
		      $(COMMON_OBJS) $(SPECIAL_OBJS) $(CRYPTO_OBJS)

lsh_export_key_OBJS = $(lsh_export_key_SOURCES:.c=.$(OBJEXT)) \
		      $(COMMON_OBJS) $(SPECIAL_OBJS) \
		      $(CRYPTO_OBJS)

lsh_make_seed_OBJS = $(lsh_make_seed_SOURCES:.c=.$(OBJEXT)) \
		       $(COMMON_OBJS) $(SPECIAL_OBJS) \
		       $(CRYPTO_OBJS)

Niels Möller's avatar
Niels Möller committed
232 233 234 235 236 237 238
lshd_OBJS = $(lshd_SOURCES:.c=.$(OBJEXT)) \
	    $(COMMON_OBJS) $(SPECIAL_OBJS) $(SERVER_OBJS) $(CRYPTO_OBJS) $(TRANSPORT_OBJS)

lshd_userauth_OBJS = $(lshd_userauth_SOURCES:.c=.$(OBJEXT)) \
		     $(COMMON_OBJS) $(SPECIAL_OBJS) $(SERVER_OBJS) $(CRYPTO_OBJS)

lshd_connection_OBJS = $(lshd_connection_SOURCES:.c=.$(OBJEXT)) \
239 240 241 242
		       $(COMMON_OBJS) $(MINIMAL_OBJS) $(SERVER_OBJS) $(TTY_OBJS) \
		       $(pty_helper_OBJS) $(CONNECTION_OBJS)

lshd_pty_helper_OBJS = $(lshd_pty_helper_SOURCES:.c=.$(OBJEXT)) $(pty_helper_OBJS)
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257

.c.$(OBJEXT):
	$(COMPILE) -c $< \
	&& $(DEP_PROCESS)

.c.m$(OBJEXT):
	$(COMPILE) -DLSH_MINIMAL -c $< -o $@ \
	&& $(DEP_PROCESS)

# This is GNU make specific
%.x: % $(srcdir)/scm/gaba.scm $(srcdir)/scm/compiler.scm
	$(SCHEME) -e main -l $(srcdir)/scm/compiler.scm \
		  -s $(srcdir)/scm/gaba.scm <$< >$(srcdir)/$(*F).xT
	test -s $(srcdir)/$(*F).xT && mv -f $(srcdir)/$(*F).xT $(srcdir)/$(*F).x

258 259 260 261
class-map: $(srcdir)/make-class-map $(dist_classes)
	(cd $(srcdir) && cat $(dist_classes) | grep '^CLASS:' \
	| sort | awk -f ./make-class-map > $@)

262 263 264 265 266 267 268 269 270
# FIXME: Won't work if the filename contains `,', `\', `"' or newline.
# NOTE: This rule is used by non-maintainer builds, so avoid using
# $< and $@ which are only available with GNU make.
environ.h: environ.h.in Makefile
	(echo '/* Automatically generated from environ.h.in, by make. */' ; \
	sed -e 's,@''prefix@,$(prefix),' \
	    -e 's,@''bindir@,$(bindir),' \
	    -e 's,@''sbindir@,$(sbindir),' \
	    -e 's,@''libexecdir@,$(libexecdir),' \
271
	    -e 's,@''localstatedir@,$(localstatedir),' \
272 273 274 275 276
	    -e 's,@''sysconfdir@,$(sysconfdir),' \
	  < $(srcdir)/environ.h.in) >environ.hT
	test -s environ.hT && mv -f environ.hT environ.h

atoms_defines.h: atoms.in process_atoms
Niels Möller's avatar
Niels Möller committed
277 278
	$(srcdir)/process_atoms header <$< >$(srcdir)/atoms_defines.hT
	test -s $(srcdir)/atoms_defines.hT && mv -f $(srcdir)/atoms_defines.hT $(srcdir)/atoms_defines.h
279 280 281 282 283

# With the next version of gperf, add -F ", 0"
GPERF_FLAGS = -LANSI-C -t -c -C -l -k1,3,6,10,21,$$ -N gperf_atom 
atoms_gperf.c: atoms.in process_atoms
	$(srcdir)/process_atoms gperf <$< \
Niels Möller's avatar
Niels Möller committed
284 285
             | gperf $(GPERF_FLAGS) | sed 's/{""}/{"", 0}/g' >$(srcdir)/atoms_gperf.cT 
	test -s $(srcdir)/atoms_gperf.cT && mv -f $(srcdir)/atoms_gperf.cT $(srcdir)/atoms_gperf.c
286 287

atoms_table.c: atoms.in process_atoms
Niels Möller's avatar
Niels Möller committed
288 289
	$(srcdir)/process_atoms table <$< >$(srcdir)/atoms_table.cT
	test -s $(srcdir)/atoms_table.cT && mv -f $(srcdir)/atoms_table.cT $(srcdir)/atoms_table.c
290 291

packet_types.h: ssh.h invert-defs
Niels Möller's avatar
Niels Möller committed
292 293
	$(srcdir)/invert-defs <$< >$(srcdir)/packet_types.hT
	test -s $(srcdir)/packet_types.hT && mv -f $(srcdir)/packet_types.hT $(srcdir)/packet_types.h
294 295


Niels Möller's avatar
Niels Möller committed
296
# FIXME: Trim library dependencies, not all should depend on hogweed and gmp
297 298 299 300
lsh$(EXEEXT): $(lsh_OBJS)
	$(LINK) $(lsh_OBJS) $(LIBS) -o $@

lsh-transport$(EXEEXT): $(lsh_transport_OBJS)
Niels Möller's avatar
Niels Möller committed
301
	$(LINK) $(lsh_transport_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
302

303
lsh-keygen$(EXEEXT): $(lsh_keygen_OBJS)
Niels Möller's avatar
Niels Möller committed
304
	$(LINK) $(lsh_keygen_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
305 306

lsh-decrypt-key$(EXEEXT): $(lsh_decrypt_key_OBJS)
Niels Möller's avatar
Niels Möller committed
307
	$(LINK) $(lsh_decrypt_key_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
308

309
lsh-decode-key$(EXEEXT): $(lsh_decode_key_OBJS)
Niels Möller's avatar
Niels Möller committed
310
	$(LINK) $(lsh_decode_key_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
311 312

lsh-export-key$(EXEEXT): $(lsh_export_key_OBJS)
Niels Möller's avatar
Niels Möller committed
313
	$(LINK) $(lsh_export_key_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
314 315

lsh-make-seed$(EXEEXT): $(lsh_make_seed_OBJS)
Niels Möller's avatar
Niels Möller committed
316
	$(LINK) $(lsh_make_seed_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
317

Niels Möller's avatar
Niels Möller committed
318
lshd$(EXEEXT): $(lshd_OBJS)
Niels Möller's avatar
Niels Möller committed
319
	$(LINK) $(lshd_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
Niels Möller's avatar
Niels Möller committed
320 321

lshd-userauth$(EXEEXT): $(lshd_userauth_OBJS)
Niels Möller's avatar
Niels Möller committed
322
	$(LINK) $(lshd_userauth_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
Niels Möller's avatar
Niels Möller committed
323 324

lshd-connection$(EXEEXT): $(lshd_connection_OBJS)
Niels Möller's avatar
Niels Möller committed
325
	$(LINK) $(lshd_connection_OBJS) $(LIBS) -o $@
Niels Möller's avatar
Niels Möller committed
326

327 328 329
lshd-pty-helper$(EXEEXT): $(lshd_pty_helper_OBJS)
	$(LINK) $(lshd_pty_helper_OBJS) $(LIBS) -o $@

330
# Currently, all scripts are in the source directory.
331
install: $(BIN_PROGRAMS) $(SBIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
332 333
	$(MKDIR_P) $(DESTDIR)$(bindir)
	$(MKDIR_P) $(DESTDIR)$(sbindir)
334
	$(MKDIR_P) $(DESTDIR)$(libexecdir)
335 336 337 338 339 340 341 342 343
	for f in $(BIN_PROGRAMS) ; do \
	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(bindir) ; \
	done
	for f in $(SCRIPTS) ; do \
	  $(INSTALL_PROGRAM) $(srcdir)/$$f $(DESTDIR)$(bindir) ; \
	done
	for f in $(SBIN_PROGRAMS) ; do \
	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(sbindir) ; \
	done
344 345 346
	for f in $(LIBEXEC_PROGRAMS) ; do \
	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(libexecdir) ; \
	done
347 348 349 350 351

uninstall:
	cd $(DESTDIR)$(bindir) && rm -f $(BIN_PROGRAMS) $(SCRIPTS)
	cd $(DESTDIR)$(sbindir) && rm -f $(SBIN_PROGRAMS)

352
distdir: $(DISTFILES)
Niels Möller's avatar
Niels Möller committed
353 354 355 356
	set -e; \
	mkdir "$(distdir)/scm" ; \
	cp $(srcdir)/scm/*.scm "$(distdir)/scm" ; \
	for f in $(DISTFILES) ; do \
357 358 359 360 361 362 363 364 365
	  if [ -f "$$f" ] ; then cp "$$f" "$(distdir)" ; \
	  else cp "$(srcdir)/$$f" "$(distdir)" ; \
	  fi ; \
	done ; \
	set -e; for d in $(SUBDIRS); do \
	  sd="$(distdir)/$$d" ; \
	  mkdir "$$sd" && $(MAKE) -C $$d distdir="`cd $$sd && pwd`" $@ ; \
	done

366 367 368 369 370 371 372 373 374 375
clean-here:
	-rm -f $(TARGETS) *.$(OBJEXT) *.m$(OBJEXT)

distclean-here: clean-here
	-rm -f config.h stamp-h	config.make environ.h Makefile *.d

maintainer-clean-here:
	-rm -f $(generated_sources)

tags-here:	
376
	etags -o $(srcdir)/TAGS $(srcdir)/*.c $(srcdir)/*.h
377

378 379 380 381 382 383 384 385 386 387
# Standard targets
Makefile: $(srcdir)/Makefile.in ../config.status
	cd .. && $(SHELL) ./config.status src/Makefile

config.make: $(srcdir)/config.make.in ../config.status
	cd .. && $(SHELL) ./config.status src/config.make

config.h: $(srcdir)/config.h.in ../config.status
	cd .. && $(SHELL) ./config.status src/config.h

Niels Möller's avatar
Niels Möller committed
388
@DEP_INCLUDE@ $(SOURCES:.c=.$(OBJEXT).d) $(SPECIAL_SOURCES:.c=.m$(OBJEXT).d)