Makefile.in 5.07 KB
Newer Older
1
2
3
4
5
6
LTC=libtomcrypt/libtomcrypt.a
LTM=libtommath/libtommath.a

COMMONOBJS=dbutil.o common-session.o common-packet.o common-algo.o buffer.o \
		common-kex.o dss.o bignum.o \
		signkey.o rsa.o random.o common-channel.o \
7
		common-chansession.o queue.o termcodes.o  \
8
		loginrec.o atomicio.o svr-x11fwd.o tcpfwd-direct.o compat.o \
Matt Johnston's avatar
Matt Johnston committed
9
		tcpfwd-remote.o listener.o process-packet.o common-runopts.o
10

Matt Johnston's avatar
Matt Johnston committed
11
SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
		svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \
		svr-chansession.o svr-runopts.o svr-agentfwd.o

CLIOBJS=

OBJS=$(COMMONOBJS) $(SVROBJS)

DROPBEAROBJS=main.o

DROPBEARKEYOBJS=dropbearkey.o gendss.o genrsa.o

CONVERTOBJS=dropbearconvert.o keyimport.o

SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o

HEADERS=options.h dbutil.h session.h packet.h algo.h ssh.h buffer.h kex.h \
		dss.h bignum.h signkey.h rsa.h random.h service.h auth.h authpasswd.h \
Matt Johnston's avatar
Matt Johnston committed
29
		debug.h channel.h chansession.h config.h queue.h sshpty.h \
30
		termcodes.h gendss.h genrsa.h authpubkey.h runopts.h includes.h \
31
32
		loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd-direct.h compat.h \
		tcpfwd-remote.h listener.h
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

ALLOBJS=$(OBJS) $(DROPBEARKEYOBJS) $(DROPBEAROBJS)

prefix=@[email protected]
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
sbindir=${exec_prefix}/sbin

CC=@[email protected]
LD=@[email protected]
AR=@[email protected]
RANLIB=@[email protected]
STRIP=@[email protected]
INSTALL=@[email protected]
CFLAGS=-Ilibtomcrypt @[email protected]
LIBS=$(LTC) $(LTM) @[email protected]
LDFLAGS=@[email protected]

# these are exported so that libtomcrypt's makefile will use them
export CC
export CFLAGS
export RANLIB AR STRIP

all: dropbear dropbearkey dropbearconvert
	@echo
	@echo Run \"make strip\" if you want stripped binaries,
	@echo or \"make install\" to install to ${prefix}

strip:
	-$(STRIP) dropbear
	-$(STRIP) dropbearkey
	-$(STRIP) dropbearconvert

install: all
	$(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
	$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
	$(INSTALL) -m 755 dropbear $(DESTDIR)$(sbindir)
	$(INSTALL) -m 755 dropbearkey $(DESTDIR)$(bindir)
	$(INSTALL) -m 755 dropbearconvert $(DESTDIR)$(bindir)
	# chown might fail, so do it separately to the install
	-chown root $(DESTDIR)$(sbindir)/dropbear
	-chgrp 0 $(DESTDIR)$(sbindir)/dropbear
	-chown root $(DESTDIR)$(bindir)/dropbearkey
	-chgrp 0 $(DESTDIR)$(bindir)/dropbearkey
	-chown root $(DESTDIR)$(bindir)/dropbearconvert
	-chgrp 0 $(DESTDIR)$(bindir)/dropbearconvert


static: dropbear-static dropbearkey-static dropbearconvert-static

$(ALLOBJS): $(HEADERS) Makefile

dropbear: $(DROPBEAROBJS) $(OBJS) $(HEADERS) Makefile $(LTC) $(LTM)
	$(LD) $(LDFLAGS) -o dropbear $(DROPBEAROBJS) $(OBJS) $(LIBS)

dropbear-static: $(DROPBEAROBJS) $(OBJS) $(HEADERS) Makefile  $(LTC) $(LTM)
	$(LD) $(LDFLAGS) -o staticdropbear $(DROPBEAROBJS) $(OBJS) $(LIBS) -static

dropbearkey: $(OBJS) $(HEADERS) Makefile $(DROPBEARKEYOBJS) $(LTC) $(LTM)
	$(LD) $(LDFLAGS) -o dropbearkey $(DROPBEARKEYOBJS) \
		$(OBJS) $(LIBS)

dropbearkey-static: $(OBJS) $(HEADERS) Makefile $(DROPBEARKEYOBJS) $(LTC) $(LTM)
	$(LD) $(LDFLAGS) -o staticdropbearkey $(DROPBEARKEYOBJS) \
		$(OBJS) $(LIBS) -static

dropbearconvert: $(OBJS) $(HEADERS) Makefile $(CONVERTOBJS) $(LTC) $(LTM)
	$(LD) $(LDFLAGS) -o dropbearconvert $(CONVERTOBJS) $(OBJS) $(LIBS)

dropbearconvert-static: $(OBJS) $(HEADERS) Makefile $(CONVERTOBJS) $(LTC) $(LTM)
	$(LD) $(LDFLAGS) -o staticdropbearconvert $(CONVERTOBJS) $(OBJS) $(LIBS) \
		-static

multi: dropbearmulti

dropbearmulti: $(HEADERS) $(OBJS) $(LTC) $(LTM) $(CONVERTOBJS) \
				$(DROPBEARKEYOBJS) $(DROPBEAROBJS) dbmulti.o
	$(LD) $(LDFLAGS) -o dropbearmulti $(OBJS) $(LTM) $(LTM) $(CONVERTOBJS) \
			$(DROPBEARKEYOBJS) $(DROPBEAROBJS) dbmulti.o $(LIBS)
	@echo "You should now create symlinks to the programs you have included"
	@echo "ie 'ln -s dropbearmulti dropbear'"

dropbearmultistatic: $(HEADERS) $(OBJS) $(LTC) $(LTM) $(CONVERTOBJS) \
						$(DROPBEARKEYOBJS) $(DROPBEAROBJS) dbmulti.o
	$(LD) $(LDFLAGS) -o staticdropbearmulti $(OBJS) $(LTM) $(LTM) \
			$(CONVERTOBJS) $(DROPBEARKEYOBJS) $(DROPBEAROBJS) \
			dbmulti.o $(LIBS) -static
	@echo "You should now create symlinks to the programs you have included"
	@echo "ie 'ln -s dropbearmultistatic dropbear'"

stripmulti: dropbearmulti
	-$(STRIP) dropbearmulti


scp: $(SCPOBJS) Makefile
	$(LD) $(LDFLAGS) -o [email protected] $(SCPOBJS)

# gnumake before 3.80 is broken. So this is uglyish
scp-progress: atomicio.o scpmisc.o $(HEADERS) Makefile
	-rm scp.o progressmeter.o
	$(MAKE) CFLAGS="$(CFLAGS) -DPROGRESS_METER" scp.o progressmeter.o
	$(LD) $(LDFLAGS) -o [email protected] $(SCPOBJS)

scpstatic: $(SCPOBJS) $(HEADERS) Makefile
	$(LD) $(LDFLAGS) -o [email protected] $(SCPOBJS) -static

$(LTC): $(HEADERS)
	cd libtomcrypt && $(MAKE) clean && $(MAKE)

$(LTM): $(HEADERS)
	cd libtommath && $(MAKE)

ltc-clean:
	cd libtomcrypt && $(MAKE) clean

ltm-clean:
	cd libtommath && $(MAKE) clean

sizes: dropbear
	objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn

clean: ltc-clean ltm-clean
	-rm -f dropbear dropbear dropbearkey staticdropbear staticdropbearkey
	-rm -f dropbearconvert staticdropbearconvert scp scp-progress scpstatic
	-rm -f dropbearmulti dropbearmultistatic
	-rm -f *.o *.da *.bb *.bbg *.prof 

distclean: clean tidy
	-rm -f Makefile config.h

tidy:
	-rm -f *~ *.gcov */*~