merge of '48fdaa8706d1acda35e9d564adc9a1fbc96c18c8'
[dropbear.git] / Makefile.in
blob599f33c95316d9605b475b88c5c8a0f5f17b2409
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 COMMONOBJS=dbutil.o buffer.o \
20 dss.o bignum.o \
21 signkey.o rsa.o random.o \
22 queue.o \
23 atomicio.o compat.o fake-rfc2553.o
25 SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
26 svr-authpasswd.o svr-authpubkey.o svr-authpubkeyoptions.o svr-session.o svr-service.o \
27 svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\
28 svr-tcpfwd.o svr-authpam.o @CRYPTLIB@
30 CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
31 cli-session.o cli-service.o cli-runopts.o cli-chansession.o \
32 cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o \
33 cli-agentfwd.o list.o
35 CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
36 common-channel.o common-chansession.o termcodes.o loginrec.o \
37 tcp-accept.o listener.o process-packet.o \
38 common-runopts.o circbuffer.o
40 KEYOBJS=dropbearkey.o gendss.o genrsa.o
42 CONVERTOBJS=dropbearconvert.o keyimport.o
44 SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
46 HEADERS=options.h dbutil.h session.h packet.h algo.h ssh.h buffer.h kex.h \
47 dss.h bignum.h signkey.h rsa.h random.h service.h auth.h \
48 debug.h channel.h chansession.h config.h queue.h sshpty.h \
49 termcodes.h gendss.h genrsa.h runopts.h includes.h \
50 loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd.h compat.h \
51 listener.h fake-rfc2553.h
53 dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
54 dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
55 dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
56 dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
57 scpobjs=$(SCPOBJS)
59 VPATH=@srcdir@
60 srcdir=@srcdir@
62 prefix=@prefix@
63 exec_prefix=${prefix}
64 bindir=${exec_prefix}/bin
65 sbindir=${exec_prefix}/sbin
67 CC=@CC@
68 AR=@AR@
69 RANLIB=@RANLIB@
70 STRIP=@STRIP@
71 INSTALL=@INSTALL@
72 CPPFLAGS=@CPPFLAGS@
73 CFLAGS=-I. -I$(srcdir) -I$(srcdir)/libtomcrypt/src/headers/ $(CPPFLAGS) @CFLAGS@
74 LIBS=$(LTC) $(LTM) @LIBS@
75 LDFLAGS=@LDFLAGS@
77 EXEEXT=@EXEEXT@
79 # whether we're building client, server, or both for the common objects.
80 # evilness so we detect 'dropbear' by itself as a word
81 space:= $(empty) $(empty)
82 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
83 CFLAGS+= -DDROPBEAR_SERVER
84 endif
85 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
86 CFLAGS+= -DDROPBEAR_CLIENT
87 endif
90 # these are exported so that libtomcrypt's makefile will use them
91 export CC
92 export CFLAGS
93 export RANLIB AR STRIP
95 ifeq ($(STATIC), 1)
96 LDFLAGS+=-static
97 endif
99 ifeq ($(MULTI), 1)
100 TARGETS=dropbearmulti
101 else
102 TARGETS=$(PROGRAMS)
103 endif
105 # for the scp progress meter. The -D doesn't affect anything else.
106 ifeq ($(SCPPROGRESS), 1)
107 CFLAGS+=-DPROGRESS_METER
108 endif
110 #%: $(HEADERS)
111 #%: $(HEADERS) Makefile
112 # TODO
114 all: $(TARGETS)
116 strip: $(TARGETS)
117 $(STRIP) $(addsuffix $(EXEEXT), $(TARGETS))
119 install: $(addprefix inst_, $(TARGETS))
121 installdropbearmulti: insdbmulti $(addprefix insmulti, $(PROGRAMS))
123 insdbmulti: dropbearmulti
124 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
125 $(INSTALL) -m 755 dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)
126 -chown root $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT)
127 -chgrp 0 $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT)
129 insmultidropbear: dropbearmulti
130 -rm -f $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
131 -ln -s $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
133 insmulti%: dropbearmulti
134 -rm -f $(DESTDIR)$(bindir)/$*$(EXEEXT)
135 -ln -s $(DESTDIR)$(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$*$(EXEEXT)
137 # dropbear should go in sbin, so it needs a seperate rule
138 inst_dropbear: dropbear
139 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
140 $(INSTALL) -m 755 dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
141 -chown root $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
142 -chgrp 0 $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
144 inst_%: $*
145 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
146 $(INSTALL) -m 755 $*$(EXEEXT) $(DESTDIR)$(bindir)
147 -chown root $(DESTDIR)$(bindir)/$*$(EXEEXT)
148 -chgrp 0 $(DESTDIR)$(bindir)/$*$(EXEEXT)
151 # for some reason the rule further down doesn't like $($@objs) as a prereq.
152 dropbear: $(dropbearobjs)
153 dbclient: $(dbclientobjs)
154 dropbearkey: $(dropbearkeyobjs)
155 dropbearconvert: $(dropbearconvertobjs)
157 dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM) \
158 Makefile
159 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBS)
161 # scp doesn't use the libs so is special.
162 scp: $(SCPOBJS) $(HEADERS) Makefile
163 $(CC) $(LDFLAGS) -o $@$(EXEEXT) $(SCPOBJS)
166 # multi-binary compilation.
167 MULTIOBJS=
168 ifeq ($(MULTI),1)
169 MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
170 CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
171 endif
173 dropbearmulti: multilink
175 multibinary: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM) Makefile
176 $(CC) $(LDFLAGS) -o dropbearmulti$(EXEEXT) $(MULTIOBJS) $(LIBS)
178 multilink: multibinary $(addprefix link, $(PROGRAMS))
180 link%:
181 -rm -f $*$(EXEEXT)
182 -ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
184 $(LTC): options.h
185 cd libtomcrypt && $(MAKE) clean && $(MAKE)
187 $(LTM): options.h
188 cd libtommath && $(MAKE)
190 .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
192 ltc-clean:
193 cd libtomcrypt && $(MAKE) clean
195 ltm-clean:
196 cd libtommath && $(MAKE) clean
198 sizes: dropbear
199 objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
201 clean: ltc-clean ltm-clean thisclean
203 thisclean:
204 -rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress \
205 dropbearmulti *.o *.da *.bb *.bbg *.prof
207 distclean: clean tidy
208 -rm -f config.h
209 -rm -f Makefile
211 tidy:
212 -rm -f *~ *.gcov */*~