-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.in
More file actions
230 lines (174 loc) · 6.37 KB
/
Copy pathMakefile.in
File metadata and controls
230 lines (174 loc) · 6.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# This Makefile is for Dropbear SSH Server and Client
# @configure_input@
PROGRAMS=dropbear dbclient dropbearkey dropbearconvert scp
src = @srcdir@/src
STATIC_LTC=libtomcrypt/libtomcrypt.a
STATIC_LTM=libtommath/libtommath.a
LIBTOM_LIBS=@LIBTOM_LIBS@
CPPFLAGS+=@CPPFLAGS@ -I.
ifeq (@BUNDLED_LIBTOM@, 1)
LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
LIBTOM_CLEAN=ltc-clean ltm-clean
CPPFLAGS+=-I@srcdir@/libtomcrypt/src/headers/ -I@srcdir@/libtommath
LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
endif
OPTION_HEADERS = default_options_guard.h $(src)/sysoptions.h
ifneq ($(wildcard @srcdir@/localoptions.h),)
CPPFLAGS+=-DLOCALOPTIONS_H_EXISTS
OPTION_HEADERS += @srcdir@/localoptions.h
endif
ifneq ($(wildcard @srcdir@/distrooptions.h),)
CPPFLAGS+=-DDISTROOPTIONS_H_EXISTS
OPTION_HEADERS += @srcdir@/distrooptions.h
endif
CPPFLAGS += -I@srcdir@
MAN_DIR=@srcdir@/manpages
COMMONOBJS= dbutil.o buffer.o dbhelpers.o \
dss.o bignum.o \
signkey.o rsa.o dbrandom.o \
queue.o \
atomicio.o compat.o \
dbmalloc.o \
ltc_prng.o ecc.o ecdsa.o sk-ecdsa.o crypto_desc.o \
curve25519.o ed25519.o sk-ed25519.o \
gensignkey.o gendss.o genrsa.o gened25519.o
SVROBJS=svr-kex.o svr-auth.o svr-authpasswd.o svr-authpubkey.o \
svr-authpubkeyoptions.o svr-session.o svr-service.o \
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o \
svr-tcpfwd.o svr-authpam.o svr-x11fwd.o \
sys-creds.o sys-pty.o loginrec.o
CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
cli-session.o cli-runopts.o cli-chansession.o \
cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o \
cli-agentfwd.o cli-readconf.o
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
common-channel.o common-chansession.o termcodes.o \
tcp-accept.o listener.o process-packet.o dh_groups.o \
common-runopts.o circbuffer.o list.o netio.o chachapoly.o gcm.o \
kex-x25519.o kex-dh.o kex-ecdh.o kex-pqhybrid.o \
sntrup761.o mlkem768.o sys-self_exe.o
KEYOBJS=dropbearkey.o
CONVERTOBJS=dropbearconvert.o keyimport.o signkey_ossh.o
SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o sys-self_exe.o
dropbear_objs = $(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
dbclient_objs = $(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
dropbearkey_objs = $(COMMONOBJS) $(KEYOBJS)
dropbearconvert_objs = $(COMMONOBJS) $(CONVERTOBJS)
scp_objs = $(SCPOBJS)
ifeq (@DROPBEAR_PLUGIN@, 1)
# rdynamic makes all the global symbols of dropbear available to all the loaded shared libraries
# this allow a plugin to reuse existing crypto/utilities like base64_decode/base64_encode without
# the need to rewrite them.
PLUGIN_LIBS=-ldl -rdynamic
else
PLUGIN_LIBS=
endif
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir = @datarootdir@
bindir=@bindir@
sbindir=@sbindir@
mandir=@mandir@
.DELETE_ON_ERROR:
CC=@CC@
AR=@AR@
RANLIB=@RANLIB@
STRIP=@STRIP@
INSTALL=@INSTALL@
CPPFLAGS+=-I$(src) -I@abs_top_builddir@
CFLAGS+=@CFLAGS@ @ZLIB_CFLAGS@
LIBS+=@LIBS@ @ZLIB_LIBS@
LDFLAGS=@LDFLAGS@
STATIC=@STATIC@
# whether we're building client, server, or both for the common objects.
ifneq (,$(filter dropbear, $(PROGRAMS)))
CPPFLAGS+= -DDROPBEAR_SERVER
endif
ifneq (,$(filter dbclient, $(PROGRAMS)))
CPPFLAGS+= -DDROPBEAR_CLIENT
endif
# these are exported so that libtomcrypt's makefile will use them
export CC
export CFLAGS
export CPPFLAGS
export RANLIB AR STRIP
ifeq ($(STATIC), 1)
LDFLAGS+=-static
endif
# for the scp progress meter. The -D doesn't affect anything else.
ifeq ($(SCPPROGRESS), 1)
CPPFLAGS+=-DPROGRESS_METER
endif
everything: $(PROGRAMS) dropbearmulti
install: $(addprefix inst_, $(PROGRAMS) dropbearmulti)
# for simplicity assume all source depends on all headers
HEADERS=$(wildcard $(src)/*.h *.h) $(OPTION_HEADERS)
%_main.o: $(src)/main.c $(HEADERS)
$(CC) -DMAIN=$*_main $(CFLAGS) $(CPPFLAGS) $< -o $@ -c
dropbearmulti_main.o: $(src)/main.c
$(CC) $(addprefix -DDB_, $(PROGRAMS)) $(CFLAGS) $(CPPFLAGS) $< -o $@ -c
%.o: $(src)/%.c $(HEADERS)
$(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ -c
default_options_guard.h: $(src)/default_options.h
@echo Creating $@
@printf "/*\n > > > Do not edit this file (default_options_guard.h) < < <\nGenerated from "$^"\nLocal customisation goes in localoptions.h\n*/\n\n" > $@.tmp
@$(src)/ifndef_wrapper.sh < $^ >> $@.tmp
mv $@.tmp $@
strip: $(PROGRAMS)
$(STRIP) $(PROGRAMS)
# dropbear should go in sbin, so it needs a separate rule
inst_dropbear: dropbear
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) dropbear $(DESTDIR)$(sbindir)
$(INSTALL) -d $(DESTDIR)$(mandir)/man8
$(INSTALL) $(MAN_DIR)/dropbear.8 $(DESTDIR)$(mandir)/man8
inst_%: %
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) $* $(DESTDIR)$(bindir)
$(if $(wildcard $(MAN_DIR)/$*.1), \
$(INSTALL) -d $(DESTDIR)$(mandir)/man1; \
$(INSTALL) $(MAN_DIR)/$*.1 $(DESTDIR)$(mandir)/man1)
multi_objs=$(sort $(foreach prog, $(PROGRAMS), $($(prog)_objs)))
dropbear: $(dropbear_objs) dropbear_main.o
dbclient: $(dbclient_objs) dbclient_main.o
dropbearkey: $(dropbearkey_objs) dropbearkey_main.o
dropbearconvert: $(dropbearconvert_objs) dropbearconvert_main.o
dropbearmulti: $(multi_objs) dropbearmulti_main.o
scp: $(scp_objs) scp_main.o
dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile
$(CC) $(LDFLAGS) -o $@ $($@_objs) $@_main.o $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ $(PLUGIN_LIBS)
dbclient dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile
$(CC) $(LDFLAGS) -o $@ $($@_objs) $@_main.o $(LIBTOM_LIBS) $(LIBS)
# scp doesn't use the libs so is special.
scp: $(HEADERS) Makefile
$(CC) $(LDFLAGS) -o $@ $($@_objs) $@_main.o
dropbearmulti: $(HEADERS) $(multi_objs) $(LIBTOM_DEPS) Makefile
$(CC) $(LDFLAGS) -o $@ $(multi_objs) $@_main.o $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
$(STATIC_LTC): $(OPTION_HEADERS)
$(MAKE) -C libtomcrypt
$(STATIC_LTM): $(OPTION_HEADERS)
$(MAKE) -C libtommath
.PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean lint check
ltc-clean:
$(MAKE) -C libtomcrypt clean
ltm-clean:
$(MAKE) -C libtommath clean
sizes: dropbear
objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
clean: $(LIBTOM_CLEAN) thisclean
thisclean:
rm -f $(PROGRAMS) *.o *.da *.bb *.bbg *.prof
distclean: clean tidy
rm -f config.h
rm -f Makefile libtommath/Makefile libtomcrypt/Makefile
rm -f default_options_guard.h
rm -fr config.log config.status autom4te.cache
gitclean: distclean
rm -f aclocal.m4 config.h.in configure
rm -f config.guess config.sub install[.-]sh
tidy:
rm -f *~ *.gcov */*~
lint:
cd $(src); ./dropbear_lint.sh
check: lint
$(MAKE) -C test