Makefile.in 12.5 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
20
AUTOHEADER = autoheader

21
22
LOCAL_NETTLE_DEP = @LOCAL_NETTLE_DEP@

23
SUBDIRS = testsuite
24
25
26

include config.make

Niels Möller's avatar
Niels Möller committed
27
28
include $(srcdir)/.dist_classes
include $(srcdir)/.dist_headers
29

30
31
32
33
# 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
34
35
36

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

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

41
SBIN_PROGRAMS = lshd$(EXEEXT)
42

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

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

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

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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)

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

90
INTERACT_SOURCES = interact.c unix_interact.c
91
INTERACT_RANDOM_SOURCES = unix_random_user.c
92

Niels Möller's avatar
Niels Möller committed
93
94
TTY_SOURCES = tty.c

95
96
PIDFILE_SOURCES = pidfile.c

Niels Möller's avatar
Niels Möller committed
97
# 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
98
# And compress.c shold be needed only when we have zlib support.
Niels Möller's avatar
Niels Möller committed
99
CRYPTO_SOURCES = algorithms.c \
Niels Möller's avatar
Niels Möller committed
100
		 compress.c \
Niels Möller's avatar
Niels Möller committed
101
102
103
104
		 crypto.c \
		 dsa.c \
		 pkcs5.c \
		 rsa.c \
105
		 seed_file.c \
Niels Möller's avatar
Niels Möller committed
106
107
108
109
		 sexp.c \
		 spki.c \
		 unix_random.c \

110
111
112
# Decryption of private keys not needed on the server side.
CRYPTO_CLIENT_SOURCES = spki-decrypt.c

113
114
115
116
117
118
119
120
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
121
122
123
124
125
126
127
128
129
130
131
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

132
133
pty_helper_SOURCES = pty-helper.c

134
lsh_SOURCES = client.c \
135
136
137
138
	      client_escape.c \
	      client_pty.c \
	      client_session.c \
	      client_tcpforward.c \
139
	      client_x11.c \
140
141
	      gateway.c \
	      gateway_channel.c \
142
	      gateway_tcpforward.c \
143
	      gateway_x11.c \
144
	      lsh.c \
145
	      socks.c
146

Niels Möller's avatar
Niels Möller committed
147
148
149
lsh_transport_SOURCES = client_keyexchange.c \
			lsh-transport.c

150
151
152
153
lsh_keygen_SOURCES = lsh-keygen.c

lsh_decrypt_key_SOURCES = lsh-decrypt-key.c

154
155
156
157
158
159
lsh_decode_key_SOURCES = lsh-decode-key.c

lsh_export_key_SOURCES = lsh-export-key.c

lsh_make_seed_SOURCES = lsh-make-seed.c

160
lshd_SOURCES = daemon.c \
Niels Möller's avatar
Niels Möller committed
161
162
163
164
165
166
167
168
169
	       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 \
170
			  server_x11.c \
Niels Möller's avatar
Niels Möller committed
171
172
173
			  translate_signal.c \
			  unix_process.c

174
175
lshd_pty_helper_SOURCES = lshd-pty-helper.c

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

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

Niels Möller's avatar
Niels Möller committed
189
190
191
DISTFILES = $(SOURCES) $(HEADERS) $(SCRIPTS) \
	    .dist_headers $(dist_headers) .dist_classes $(dist_classes) \
	    atoms.in environ.h.in process_atoms invert-defs $(generated_sources) \
192
	    config.h.in stamp-h.in Makefile.in config.make.in 
193

Niels Möller's avatar
Niels Möller committed
194
195
SPECIAL_OBJS = $(SPECIAL_SOURCES:.c=.$(OBJEXT))
MINIMAL_OBJS = $(SPECIAL_SOURCES:.c=.m$(OBJEXT))
196
197
198

COMMON_OBJS = $(COMMON_SOURCES:.c=.$(OBJEXT))
INTERACT_OBJS = $(INTERACT_SOURCES:.c=.$(OBJEXT))
199
INTERACT_RANDOM_OBJS = $(INTERACT_RANDOM_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
200
TTY_OBJS = $(TTY_SOURCES:.c=.$(OBJEXT))
201
PIDFILE_OBJS = $(PIDFILE_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
202
CRYPTO_OBJS = $(CRYPTO_SOURCES:.c=.$(OBJEXT))
203
CRYPTO_CLIENT_OBJS = $(CRYPTO_CLIENT_SOURCES:.c=.$(OBJEXT))
204
TRANSPORT_OBJS = $(TRANSPORT_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
205
206
CONNECTION_OBJS = $(CONNECTION_SOURCES:.c=.$(OBJEXT))
SERVER_OBJS = $(SERVER_SOURCES:.c=.$(OBJEXT))
207
pty_helper_OBJS = $(pty_helper_SOURCES:.c=.$(OBJEXT))
Niels Möller's avatar
Niels Möller committed
208

209
lsh_OBJS = $(lsh_SOURCES:.c=.$(OBJEXT)) \
210
211
	   $(COMMON_OBJS) $(MINIMAL_OBJS) $(INTERACT_OBJS) \
	   $(TTY_OBJS) $(PIDFILE_OBJS) $(CONNECTION_OBJS)
212

213
lsh_transport_OBJS = $(lsh_transport_SOURCES:.c=.$(OBJEXT)) \
214
215
		     $(COMMON_OBJS) $(SPECIAL_OBJS) \
		     $(INTERACT_OBJS) $(INTERACT_RANDOM_OBJS) \
216
		     $(CRYPTO_OBJS) $(CRYPTO_CLIENT_OBJS) $(TRANSPORT_OBJS)
217
218

lsh_keygen_OBJS = $(lsh_keygen_SOURCES:.c=.$(OBJEXT)) \
219
220
221
		  $(COMMON_OBJS) $(SPECIAL_OBJS) \
		  $(INTERACT_OBJS) $(INTERACT_RANDOM_OBJS) \
		  $(CRYPTO_OBJS)
222
223

lsh_decrypt_key_OBJS = $(lsh_decrypt_key_SOURCES:.c=.$(OBJEXT)) \
224
225
		       $(COMMON_OBJS) $(SPECIAL_OBJS) $(INTERACT_OBJS) \
		       $(CRYPTO_OBJS) $(CRYPTO_CLIENT_OBJS)
226

227
228
229
230
231
232
233
234
235
236
237
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
238
lshd_OBJS = $(lshd_SOURCES:.c=.$(OBJEXT)) \
239
240
	    $(COMMON_OBJS) $(SPECIAL_OBJS) $(SERVER_OBJS) \
	    $(CRYPTO_OBJS) $(TRANSPORT_OBJS) $(PIDFILE_OBJS) 
Niels Möller's avatar
Niels Möller committed
241
242
243
244
245

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

lshd_connection_OBJS = $(lshd_connection_SOURCES:.c=.$(OBJEXT)) \
246
247
248
249
		       $(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)
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264

.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

265
266
267
268
class-map: $(srcdir)/make-class-map $(dist_classes)
	(cd $(srcdir) && cat $(dist_classes) | grep '^CLASS:' \
	| sort | awk -f ./make-class-map > $@)

269
270
271
272
273
274
275
276
277
# 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),' \
278
	    -e 's,@''localstatedir@,$(localstatedir),' \
279
280
281
282
283
	    -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
284
285
	$(srcdir)/process_atoms header <$< >$(srcdir)/atoms_defines.hT
	test -s $(srcdir)/atoms_defines.hT && mv -f $(srcdir)/atoms_defines.hT $(srcdir)/atoms_defines.h
286
287

# With the next version of gperf, add -F ", 0"
288
GPERF_FLAGS = -LANSI-C -t -c -C -l -k1,3,5,10,21,$$ -N gperf_atom 
289
290
atoms_gperf.c: atoms.in process_atoms
	$(srcdir)/process_atoms gperf <$< \
Niels Möller's avatar
Niels Möller committed
291
292
             | 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
293
294

atoms_table.c: atoms.in process_atoms
Niels Möller's avatar
Niels Möller committed
295
296
	$(srcdir)/process_atoms table <$< >$(srcdir)/atoms_table.cT
	test -s $(srcdir)/atoms_table.cT && mv -f $(srcdir)/atoms_table.cT $(srcdir)/atoms_table.c
297
298

packet_types.h: ssh.h invert-defs
Niels Möller's avatar
Niels Möller committed
299
300
	$(srcdir)/invert-defs <$< >$(srcdir)/packet_types.hT
	test -s $(srcdir)/packet_types.hT && mv -f $(srcdir)/packet_types.hT $(srcdir)/packet_types.h
301
302


Niels Möller's avatar
Niels Möller committed
303
# FIXME: Trim library dependencies, not all should depend on hogweed and gmp
304
305
306
lsh$(EXEEXT): $(lsh_OBJS)
	$(LINK) $(lsh_OBJS) $(LIBS) -o $@

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

310
lsh-keygen$(EXEEXT): $(lsh_keygen_OBJS) $(LOCAL_NETTLE_DEP)
Niels Möller's avatar
Niels Möller committed
311
	$(LINK) $(lsh_keygen_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
312

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

316
lsh-decode-key$(EXEEXT): $(lsh_decode_key_OBJS) $(LOCAL_NETTLE_DEP)
Niels Möller's avatar
Niels Möller committed
317
	$(LINK) $(lsh_decode_key_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
318

319
lsh-export-key$(EXEEXT): $(lsh_export_key_OBJS) $(LOCAL_NETTLE_DEP)
Niels Möller's avatar
Niels Möller committed
320
	$(LINK) $(lsh_export_key_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
321

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

325
lshd$(EXEEXT): $(lshd_OBJS) $(LOCAL_NETTLE_DEP)
Niels Möller's avatar
Niels Möller committed
326
	$(LINK) $(lshd_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
Niels Möller's avatar
Niels Möller committed
327

328
lshd-userauth$(EXEEXT): $(lshd_userauth_OBJS) $(LOCAL_NETTLE_DEP)
Niels Möller's avatar
Niels Möller committed
329
	$(LINK) $(lshd_userauth_OBJS) -lspki -lhogweed -lnettle $(LIBS) -o $@
Niels Möller's avatar
Niels Möller committed
330
331

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

334
335
336
lshd-pty-helper$(EXEEXT): $(lshd_pty_helper_OBJS)
	$(LINK) $(lshd_pty_helper_OBJS) $(LIBS) -o $@

337
# Currently, all scripts are in the source directory.
338
install: $(BIN_PROGRAMS) $(SBIN_PROGRAMS) $(LIBEXEC_PROGRAMS)
339
340
	$(MKDIR_P) $(DESTDIR)$(bindir)
	$(MKDIR_P) $(DESTDIR)$(sbindir)
341
	$(MKDIR_P) $(DESTDIR)$(libexecdir)
342
343
344
345
346
347
348
349
350
	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
351
352
353
	for f in $(LIBEXEC_PROGRAMS) ; do \
	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(libexecdir) ; \
	done
354
355
356
357

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

360
distdir: $(DISTFILES)
Niels Möller's avatar
Niels Möller committed
361
362
363
364
	set -e; \
	mkdir "$(distdir)/scm" ; \
	cp $(srcdir)/scm/*.scm "$(distdir)/scm" ; \
	for f in $(DISTFILES) ; do \
365
366
367
368
369
370
371
372
373
	  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

374
375
376
377
clean-here:
	-rm -f $(TARGETS) *.$(OBJEXT) *.m$(OBJEXT)

distclean-here: clean-here
378
	-rm -f config.h stamp-h.in config.make environ.h Makefile *.d
379
380
381
382
383

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

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

386
387
388
389
390
391
392
# Autoconf-related targets
# autoheader might not change config.h.in, so touch a stamp file.
config.h.in: stamp-h.in
stamp-h.in: ../configure.ac ../aclocal.m4
	cd $(top_srcdir) && $(AUTOHEADER)
	echo timestamp > $(srcdir)/stamp-h.in

393
394
395
396
397
398
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

399
400
config.h: stamp-h
stamp-h: $(srcdir)/config.h.in ../config.status
401
402
	cd .. && $(SHELL) ./config.status src/config.h

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