dropbear: update to 2015.67
[tomato.git] / release / src / router / dropbear / Makefile.in
blob8cde5218199e724acda03c939ab745507a70af98
1 # This Makefile is for Dropbear SSH Server and Client
2 # @configure_input@
4 # invocation:
5 # make PROGRAMS="dropbear dbclient scp" MULTI=1 STATIC=1 SCPPROGRESS=1
7 # to make a multiple-program statically linked binary "staticdropbearmulti".
8 # This example will include dropbear, scp, dropbearkey, dropbearconvert, and
9 # dbclient functionality, and includes the progress-bar functionality in scp.
10 # Hopefully that seems intuitive.
12 ifndef PROGRAMS
13 PROGRAMS=dropbear dbclient dropbearkey dropbearconvert
14 endif
16 STATIC_LTC=libtomcrypt/libtomcrypt.a
17 STATIC_LTM=libtommath/libtommath.a
19 LIBTOM_LIBS=@LIBTOM_LIBS@
21 ifeq (@BUNDLED_LIBTOM@, 1)
22 LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
23 CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
24 LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
25 endif
27 COMMONOBJS=dbutil.o buffer.o \
28 dss.o bignum.o \
29 signkey.o rsa.o dbrandom.o \
30 queue.o \
31 atomicio.o compat.o fake-rfc2553.o \
32 ltc_prng.o ecc.o ecdsa.o crypto_desc.o \
33 gensignkey.o gendss.o genrsa.o
35 SVROBJS=svr-kex.o svr-auth.o sshpty.o \
36 svr-authpasswd.o svr-authpubkey.o svr-authpubkeyoptions.o svr-session.o svr-service.o \
37 svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\
38 svr-tcpfwd.o svr-authpam.o
40 CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
41 cli-session.o cli-runopts.o cli-chansession.o \
42 cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o \
43 cli-agentfwd.o list.o
45 CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
46 common-channel.o common-chansession.o termcodes.o loginrec.o \
47 tcp-accept.o listener.o process-packet.o \
48 common-runopts.o circbuffer.o curve25519-donna.o
50 KEYOBJS=dropbearkey.o
52 CONVERTOBJS=dropbearconvert.o keyimport.o
54 SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
56 HEADERS=options.h dbutil.h session.h packet.h algo.h ssh.h buffer.h kex.h \
57 dss.h bignum.h signkey.h rsa.h dbrandom.h service.h auth.h \
58 debug.h channel.h chansession.h config.h queue.h sshpty.h \
59 termcodes.h gendss.h genrsa.h runopts.h includes.h \
60 loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd.h compat.h \
61 listener.h fake-rfc2553.h ecc.h ecdsa.h
63 dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
64 dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
65 dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
66 dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
67 scpobjs=$(SCPOBJS)
69 VPATH=@srcdir@
70 srcdir=@srcdir@
72 prefix=@prefix@
73 exec_prefix=@exec_prefix@
74 datarootdir = @datarootdir@
75 bindir=@bindir@
76 sbindir=@sbindir@
77 mandir=@mandir@
79 CC=@CC@
80 AR=@AR@
81 RANLIB=@RANLIB@
82 STRIP=@STRIP@
83 INSTALL=@INSTALL@
84 CPPFLAGS=@CPPFLAGS@
85 CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
86 LIBS+=@LIBS@
87 LDFLAGS=@LDFLAGS@
89 EXEEXT=@EXEEXT@
91 # whether we're building client, server, or both for the common objects.
92 # evilness so we detect 'dropbear' by itself as a word
93 space:= $(empty) $(empty)
94 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
95 CFLAGS+= -DDROPBEAR_SERVER
96 endif
97 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
98 CFLAGS+= -DDROPBEAR_CLIENT
99 endif
102 # these are exported so that libtomcrypt's makefile will use them
103 export CC
104 export CFLAGS
105 export RANLIB AR STRIP
107 ifeq ($(STATIC), 1)
108 LDFLAGS+=-static
109 endif
111 ifeq ($(MULTI), 1)
112 TARGETS=dropbearmulti
113 else
114 TARGETS=$(PROGRAMS)
115 endif
117 # for the scp progress meter. The -D doesn't affect anything else.
118 ifeq ($(SCPPROGRESS), 1)
119 CFLAGS+=-DPROGRESS_METER
120 endif
122 all: $(TARGETS)
124 strip: $(TARGETS)
125 $(STRIP) $(addsuffix $(EXEEXT), $(TARGETS))
127 install: $(addprefix inst_, $(TARGETS))
129 insmultidropbear: dropbearmulti
130 $(INSTALL) -d $(DESTDIR)$(sbindir)
131 -rm -f $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
132 -ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
133 $(INSTALL) -d $(DESTDIR)$(mandir)/man8
134 $(INSTALL) -m 644 $(srcdir)/dropbear.8 $(DESTDIR)$(mandir)/man8/dropbear.8
136 insmulti%: dropbearmulti
137 $(INSTALL) -d $(DESTDIR)$(bindir)
138 -rm -f $(DESTDIR)$(bindir)/$*$(EXEEXT)
139 -ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$*$(EXEEXT)
140 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
141 if test -e $*.1; then $(INSTALL) -m 644 $*.1 $(DESTDIR)$(mandir)/man1/$*.1; fi
143 # dropbear should go in sbin, so it needs a seperate rule
144 inst_dropbear: dropbear
145 $(INSTALL) -d $(DESTDIR)$(sbindir)
146 $(INSTALL) dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
147 $(INSTALL) -d $(DESTDIR)$(mandir)/man8
148 $(INSTALL) -m 644 $(srcdir)/dropbear.8 $(DESTDIR)$(mandir)/man8/dropbear.8
150 inst_%: %
151 $(INSTALL) -d $(DESTDIR)$(bindir)
152 $(INSTALL) $*$(EXEEXT) $(DESTDIR)$(bindir)
153 $(INSTALL) -d $(DESTDIR)$(mandir)/man1
154 if test -e $*.1; then $(INSTALL) -m 644 $*.1 $(DESTDIR)$(mandir)/man1/$*.1; fi
156 inst_dropbearmulti: $(addprefix insmulti, $(PROGRAMS))
159 # for some reason the rule further down doesn't like $($@objs) as a prereq.
160 dropbear: $(dropbearobjs)
161 dbclient: $(dbclientobjs)
162 dropbearkey: $(dropbearkeyobjs)
163 dropbearconvert: $(dropbearconvertobjs)
165 dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile
166 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
168 dbclient: $(HEADERS) $(LIBTOM_DEPS) Makefile
169 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS)
171 dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile
172 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS)
174 # scp doesn't use the libs so is special.
175 scp: $(SCPOBJS) $(HEADERS) Makefile
176 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS)
179 # multi-binary compilation.
180 MULTIOBJS=
181 ifeq ($(MULTI),1)
182 MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
183 CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
184 endif
186 dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile
187 $(CC) $(LDFLAGS) -o $@ $(MULTIOBJS) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
189 multibinary: dropbearmulti$(EXEEXT)
191 multilink: multibinary $(addprefix link, $(PROGRAMS))
193 link%:
194 -rm -f $*$(EXEEXT)
195 -ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
197 $(STATIC_LTC): options.h
198 cd libtomcrypt && $(MAKE)
200 $(STATIC_LTM): options.h
201 cd libtommath && $(MAKE)
203 .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
205 ltc-clean:
206 cd libtomcrypt && $(MAKE) clean
208 ltm-clean:
209 cd libtommath && $(MAKE) clean
211 sizes: dropbear
212 objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
214 clean: ltc-clean ltm-clean thisclean
216 thisclean:
217 -rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress \
218 dropbearmulti *.o *.da *.bb *.bbg *.prof
220 distclean: clean tidy
221 -rm -f config.h
222 -rm -f Makefile
224 tidy:
225 -rm -f *~ *.gcov */*~