dropbar: Update to version 2013.60.1.
[tomato.git] / release / src / router / dropbear / Makefile.in
blob2f9e52faa83ce75230dfa206b8fc0a9d6ba98bec
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 LTC=libtomcrypt/libtomcrypt.a
17 LTM=libtommath/libtommath.a
19 ifeq (@BUNDLED_LIBTOM@, 1)
20 LIBTOM_DEPS=$(LTC) $(LTM)
21 CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
22 LIBS+=$(LTC) $(LTM)
23 endif
25 COMMONOBJS=dbutil.o buffer.o \
26 dss.o bignum.o \
27 signkey.o rsa.o random.o \
28 queue.o \
29 atomicio.o compat.o fake-rfc2553.o
31 SVROBJS=svr-kex.o svr-auth.o sshpty.o \
32 svr-authpasswd.o svr-authpubkey.o svr-authpubkeyoptions.o svr-session.o svr-service.o \
33 svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\
34 svr-tcpfwd.o svr-authpam.o
36 CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
37 cli-session.o cli-runopts.o cli-chansession.o \
38 cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o \
39 cli-agentfwd.o list.o
41 CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
42 common-channel.o common-chansession.o termcodes.o loginrec.o \
43 tcp-accept.o listener.o process-packet.o \
44 common-runopts.o circbuffer.o
46 KEYOBJS=dropbearkey.o gendss.o genrsa.o
48 CONVERTOBJS=dropbearconvert.o keyimport.o
50 SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
52 HEADERS=options.h dbutil.h session.h packet.h algo.h ssh.h buffer.h kex.h \
53 dss.h bignum.h signkey.h rsa.h random.h service.h auth.h \
54 debug.h channel.h chansession.h config.h queue.h sshpty.h \
55 termcodes.h gendss.h genrsa.h runopts.h includes.h \
56 loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd.h compat.h \
57 listener.h fake-rfc2553.h
59 dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS) @CRYPTLIB@
60 dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
61 dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
62 dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
63 scpobjs=$(SCPOBJS)
65 VPATH=@srcdir@
66 srcdir=@srcdir@
68 prefix=@prefix@
69 exec_prefix=@exec_prefix@
70 datarootdir = @datarootdir@
71 bindir=@bindir@
72 sbindir=@sbindir@
73 mandir=@mandir@
75 CC=@CC@
76 AR=@AR@
77 RANLIB=@RANLIB@
78 STRIP=@STRIP@
79 INSTALL=@INSTALL@
80 CPPFLAGS=@CPPFLAGS@
81 CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
82 LIBS+=@LIBS@
83 LDFLAGS=@LDFLAGS@
85 EXEEXT=@EXEEXT@
87 # whether we're building client, server, or both for the common objects.
88 # evilness so we detect 'dropbear' by itself as a word
89 space:= $(empty) $(empty)
90 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
91 CFLAGS+= -DDROPBEAR_SERVER
92 endif
93 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
94 CFLAGS+= -DDROPBEAR_CLIENT
95 endif
98 # these are exported so that libtomcrypt's makefile will use them
99 export CC
100 export CFLAGS
101 export RANLIB AR STRIP
103 ifeq ($(STATIC), 1)
104 LDFLAGS+=-static
105 endif
107 ifeq ($(MULTI), 1)
108 TARGETS=dropbearmulti
109 else
110 TARGETS=$(PROGRAMS)
111 endif
113 # for the scp progress meter. The -D doesn't affect anything else.
114 ifeq ($(SCPPROGRESS), 1)
115 CFLAGS+=-DPROGRESS_METER
116 endif
118 all: $(TARGETS)
120 strip: $(TARGETS)
121 $(STRIP) $(addsuffix $(EXEEXT), $(TARGETS))
123 install: $(addprefix inst_, $(TARGETS))
125 installdropbearmulti: insdbmulti $(addprefix insmulti, $(PROGRAMS))
127 insdbmulti: dropbearmulti
128 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
129 $(INSTALL) -m 755 dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)
130 -chown root $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT)
131 -chgrp 0 $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT)
133 insmultidropbear: dropbearmulti
134 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
135 -rm -f $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
136 -ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
138 insmulti%: dropbearmulti
139 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
140 -rm -f $(DESTDIR)$(bindir)/$*$(EXEEXT)
141 -ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$*$(EXEEXT)
143 # dropbear should go in sbin, so it needs a seperate rule
144 inst_dropbear: dropbear
145 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
146 $(INSTALL) -m 755 dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
147 -chown root $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
148 -chgrp 0 $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
150 inst_%: $*
151 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
152 $(INSTALL) -m 755 $*$(EXEEXT) $(DESTDIR)$(bindir)
153 -chown root $(DESTDIR)$(bindir)/$*$(EXEEXT)
154 -chgrp 0 $(DESTDIR)$(bindir)/$*$(EXEEXT)
157 # for some reason the rule further down doesn't like $($@objs) as a prereq.
158 dropbear: $(dropbearobjs)
159 dbclient: $(dbclientobjs)
160 dropbearkey: $(dropbearkeyobjs)
161 dropbearconvert: $(dropbearconvertobjs)
163 dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile
164 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBS)
166 # scp doesn't use the libs so is special.
167 scp: $(SCPOBJS) $(HEADERS) Makefile
168 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS)
171 # multi-binary compilation.
172 MULTIOBJS=
173 ifeq ($(MULTI),1)
174 MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs))) @CRYPTLIB@
175 CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
176 endif
178 dropbearmulti: multilink
180 multibinary: $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile
181 $(CC) $(LDFLAGS) -o dropbearmulti$(EXEEXT) $(MULTIOBJS) $(LIBS)
183 multilink: multibinary $(addprefix link, $(PROGRAMS))
185 link%:
186 -rm -f $*$(EXEEXT)
187 -ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
189 $(LTC): options.h
190 cd libtomcrypt && $(MAKE) clean && $(MAKE)
192 $(LTM): options.h
193 cd libtommath && $(MAKE)
195 .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
197 ltc-clean:
198 cd libtomcrypt && $(MAKE) clean
200 ltm-clean:
201 cd libtommath && $(MAKE) clean
203 sizes: dropbear
204 objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
206 clean: ltc-clean ltm-clean thisclean
208 thisclean:
209 -rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress \
210 dropbearmulti *.o *.da *.bb *.bbg *.prof
212 distclean: clean tidy
213 -rm -f config.h
214 -rm -f Makefile
216 tidy:
217 -rm -f *~ *.gcov */*~