Changes to update Tomato RAF.
[tomato.git] / release / src / router / dropbear / Makefile.in
blobcec35f179cf073dbfef7007ae754a56b216101fc
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-algo.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-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
37 cli-session.o cli-service.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=${prefix}
70 bindir=${exec_prefix}/bin
71 sbindir=${exec_prefix}/sbin
73 CC=@CC@
74 AR=@AR@
75 RANLIB=@RANLIB@
76 STRIP=@STRIP@
77 INSTALL=@INSTALL@
78 CPPFLAGS=@CPPFLAGS@
79 CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
80 LIBS+=@LIBS@
81 LDFLAGS=@LDFLAGS@
83 EXEEXT=@EXEEXT@
85 # whether we're building client, server, or both for the common objects.
86 # evilness so we detect 'dropbear' by itself as a word
87 space:= $(empty) $(empty)
88 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
89 CFLAGS+= -DDROPBEAR_SERVER
90 endif
91 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
92 CFLAGS+= -DDROPBEAR_CLIENT
93 endif
96 # these are exported so that libtomcrypt's makefile will use them
97 export CC
98 export CFLAGS
99 export RANLIB AR STRIP
101 ifeq ($(STATIC), 1)
102 LDFLAGS+=-static
103 endif
105 ifeq ($(MULTI), 1)
106 TARGETS=dropbearmulti
107 else
108 TARGETS=$(PROGRAMS)
109 endif
111 # for the scp progress meter. The -D doesn't affect anything else.
112 ifeq ($(SCPPROGRESS), 1)
113 CFLAGS+=-DPROGRESS_METER
114 endif
116 all: $(TARGETS)
118 strip: $(TARGETS)
119 $(STRIP) $(addsuffix $(EXEEXT), $(TARGETS))
121 install: $(addprefix inst_, $(TARGETS))
123 installdropbearmulti: insdbmulti $(addprefix insmulti, $(PROGRAMS))
125 insdbmulti: dropbearmulti
126 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
127 $(INSTALL) -m 755 dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)
128 -chown root $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT)
129 -chgrp 0 $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT)
131 insmultidropbear: dropbearmulti
132 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
133 -rm -f $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
134 -ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
136 insmulti%: dropbearmulti
137 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
138 -rm -f $(DESTDIR)$(bindir)/$*$(EXEEXT)
139 -ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$*$(EXEEXT)
141 # dropbear should go in sbin, so it needs a seperate rule
142 inst_dropbear: dropbear
143 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
144 $(INSTALL) -m 755 dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
145 -chown root $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
146 -chgrp 0 $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
148 inst_%: $*
149 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
150 $(INSTALL) -m 755 $*$(EXEEXT) $(DESTDIR)$(bindir)
151 -chown root $(DESTDIR)$(bindir)/$*$(EXEEXT)
152 -chgrp 0 $(DESTDIR)$(bindir)/$*$(EXEEXT)
155 # for some reason the rule further down doesn't like $($@objs) as a prereq.
156 dropbear: $(dropbearobjs)
157 dbclient: $(dbclientobjs)
158 dropbearkey: $(dropbearkeyobjs)
159 dropbearconvert: $(dropbearconvertobjs)
161 dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile
162 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBS)
164 # scp doesn't use the libs so is special.
165 scp: $(SCPOBJS) $(HEADERS) Makefile
166 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS)
169 # multi-binary compilation.
170 MULTIOBJS=
171 ifeq ($(MULTI),1)
172 MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs))) @CRYPTLIB@
173 CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
174 endif
176 dropbearmulti: multilink
178 multibinary: $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile
179 $(CC) $(LDFLAGS) -o dropbearmulti$(EXEEXT) $(MULTIOBJS) $(LIBS)
181 multilink: multibinary $(addprefix link, $(PROGRAMS))
183 link%:
184 -rm -f $*$(EXEEXT)
185 -ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
187 $(LTC): options.h
188 cd libtomcrypt && $(MAKE) clean && $(MAKE)
190 $(LTM): options.h
191 cd libtommath && $(MAKE)
193 .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
195 ltc-clean:
196 cd libtomcrypt && $(MAKE) clean
198 ltm-clean:
199 cd libtommath && $(MAKE) clean
201 sizes: dropbear
202 objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
204 clean: ltc-clean ltm-clean thisclean
206 thisclean:
207 -rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress \
208 dropbearmulti *.o *.da *.bb *.bbg *.prof
210 distclean: clean tidy
211 -rm -f config.h
212 -rm -f Makefile
214 tidy:
215 -rm -f *~ *.gcov */*~