2004-07-27 13:32:54 +00:00
|
|
|
# This Makefile is for Dropbear SSH Server and Client
|
|
|
|
|
|
|
|
# invocation:
|
|
|
|
# make PROGRAMS="dropbear dbclient scp" MULTI=1 STATIC=1 SCPPROGRESS=1
|
|
|
|
#
|
|
|
|
# to make a single multiple statically linked binary "staticdropbearmulti",
|
|
|
|
# which includes dropbear, scp and dbclient functionality, and includes the
|
|
|
|
# progress-bar functionality in scp. Hopefully that seems intuitive.
|
|
|
|
|
|
|
|
# This makefile is quite evil.
|
|
|
|
|
|
|
|
ifndef PROGRAMS
|
2004-08-07 15:50:58 +00:00
|
|
|
PROGRAMS=dropbear dbclient dropbearkey dropbearkey
|
2004-07-27 13:32:54 +00:00
|
|
|
endif
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
LTC=libtomcrypt/libtomcrypt.a
|
|
|
|
LTM=libtommath/libtommath.a
|
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
COMMONOBJS=dbutil.o buffer.o \
|
|
|
|
dss.o bignum.o \
|
|
|
|
signkey.o rsa.o random.o \
|
|
|
|
queue.o \
|
|
|
|
atomicio.o compat.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-06-23 07:24:22 +00:00
|
|
|
SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
|
2004-06-01 02:46:09 +00:00
|
|
|
svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \
|
2004-08-10 17:09:52 +00:00
|
|
|
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\
|
|
|
|
svr-tcpfwd.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
2004-08-08 16:55:03 +00:00
|
|
|
cli-session.o cli-service.o cli-runopts.o cli-chansession.o \
|
2004-08-10 17:09:52 +00:00
|
|
|
cli-authpubkey.o cli-tcpfwd.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
|
|
|
|
common-channel.o common-chansession.o termcodes.o loginrec.o \
|
2004-08-12 13:54:31 +00:00
|
|
|
tcp-accept.o listener.o process-packet.o \
|
2004-08-12 14:39:17 +00:00
|
|
|
common-runopts.o fake-rfc2553.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
KEYOBJS=dropbearkey.o gendss.o genrsa.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
CONVERTOBJS=dropbearconvert.o keyimport.o
|
|
|
|
|
|
|
|
SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o
|
|
|
|
|
|
|
|
HEADERS=options.h dbutil.h session.h packet.h algo.h ssh.h buffer.h kex.h \
|
2004-08-12 14:56:22 +00:00
|
|
|
dss.h bignum.h signkey.h rsa.h random.h service.h auth.h \
|
2004-06-23 07:24:22 +00:00
|
|
|
debug.h channel.h chansession.h config.h queue.h sshpty.h \
|
2004-08-12 14:56:22 +00:00
|
|
|
termcodes.h gendss.h genrsa.h runopts.h includes.h \
|
2004-08-12 13:48:42 +00:00
|
|
|
loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd.h compat.h \
|
2004-08-12 14:39:17 +00:00
|
|
|
listener.h fake-rfc2553.h
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
|
|
|
|
dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
|
2004-07-27 13:32:54 +00:00
|
|
|
dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
|
|
|
|
dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
|
|
|
|
scpobjs=$(SCPOBJS)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=${prefix}
|
|
|
|
bindir=${exec_prefix}/bin
|
|
|
|
sbindir=${exec_prefix}/sbin
|
|
|
|
|
|
|
|
CC=@CC@
|
2004-07-27 14:44:43 +00:00
|
|
|
LD=@LD@
|
2004-06-01 02:46:09 +00:00
|
|
|
AR=@AR@
|
|
|
|
RANLIB=@RANLIB@
|
|
|
|
STRIP=@STRIP@
|
|
|
|
INSTALL=@INSTALL@
|
2004-07-27 15:12:29 +00:00
|
|
|
CFLAGS=-Ilibtomcrypt @CFLAGS@
|
2004-06-01 02:46:09 +00:00
|
|
|
LIBS=$(LTC) $(LTM) @LIBS@
|
|
|
|
LDFLAGS=@LDFLAGS@
|
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
EXEEXT=@EXEEXT@
|
|
|
|
|
|
|
|
# whether we're building client, server, or both for the common objects.
|
|
|
|
# evilness so we detect 'dropbear' by itself as a word
|
2004-07-27 14:44:43 +00:00
|
|
|
space:= $(empty) $(empty)
|
|
|
|
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
|
|
|
|
CFLAGS+= -DDROPBEAR_SERVER
|
2004-07-27 13:32:54 +00:00
|
|
|
endif
|
2004-07-27 14:44:43 +00:00
|
|
|
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
|
|
|
|
CFLAGS+= -DDROPBEAR_CLIENT
|
2004-07-27 13:32:54 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
# these are exported so that libtomcrypt's makefile will use them
|
|
|
|
export CC
|
|
|
|
export CFLAGS
|
|
|
|
export RANLIB AR STRIP
|
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
ifeq ($(STATIC), 1)
|
|
|
|
LDFLAGS+=-static
|
|
|
|
SPREFIX=static
|
|
|
|
else
|
|
|
|
SPREFIX=
|
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
ifeq ($(MULTI), 1)
|
|
|
|
TARGETS=dropbearmulti
|
|
|
|
else
|
|
|
|
TARGETS=$(PROGRAMS)
|
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
# for the scp progress meter. The -D doesn't affect anything else.
|
|
|
|
ifeq ($(SCPPROGRESS), 1)
|
|
|
|
CFLAGS+=-DPROGRESS_METER
|
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
#%: $(HEADERS)
|
|
|
|
#%: $(HEADERS) Makefile
|
|
|
|
# TODO
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
all: $(TARGETS)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
strip: $(TARGETS)
|
|
|
|
$(STRIP) $(addsuffix $(EXEEXT), $(addprefix $(SPREFIX), $(TARGETS)))
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
install: $(addprefix install, $(TARGETS))
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
# dropbear should go in sbin, so it needs a seperate rule
|
|
|
|
installdropbear: dropbear
|
|
|
|
$(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
|
|
|
|
$(INSTALL) -m 755 $(SPREFIX)dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
|
|
|
|
-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)dropbear$(EXEEXT)
|
|
|
|
-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)dropbear$(EXEEXT)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
install%: $*
|
|
|
|
$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
|
|
|
|
$(INSTALL) -m 755 $(SPREFIX)$*$(EXEEXT) $(DESTDIR)$(bindir)
|
|
|
|
-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
|
|
|
-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
|
|
|
ifeq ($(MULTI), 1)
|
2004-07-27 14:44:43 +00:00
|
|
|
@echo
|
2004-07-27 13:32:54 +00:00
|
|
|
@echo "You must manually create links for $*"
|
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
# for some reason the rule further down doesn't like $($@objs) as a prereq.
|
2004-07-27 13:32:54 +00:00
|
|
|
dropbear: $(dropbearobjs)
|
2004-07-27 14:44:43 +00:00
|
|
|
dbclient: $(dbclientobjs)
|
|
|
|
dropbearkey: $(dropbearkeyobjs)
|
|
|
|
dropbearconvert: $(dropbearconvertobjs)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 16:30:46 +00:00
|
|
|
dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM) \
|
|
|
|
Makefile
|
2004-07-27 13:32:54 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
# scp doesn't use the libs so is special.
|
2004-07-27 16:30:46 +00:00
|
|
|
scp: $(SCPOBJS) $(HEADERS) Makefile
|
2004-07-27 13:32:54 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
# multi-binary compilation.
|
|
|
|
MULTIOBJS=
|
2004-07-27 13:32:54 +00:00
|
|
|
ifeq ($(MULTI),1)
|
2004-07-27 14:44:43 +00:00
|
|
|
MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
|
|
|
|
CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
|
2004-07-27 13:32:54 +00:00
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 16:30:46 +00:00
|
|
|
dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM) Makefile
|
2004-07-27 13:32:54 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS)
|
2004-07-27 14:44:43 +00:00
|
|
|
@echo
|
2004-07-27 13:32:54 +00:00
|
|
|
@echo "You should now create symlinks to the programs you have included"
|
|
|
|
@echo "ie 'ln -s dropbearmulti dropbear'"
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 16:30:46 +00:00
|
|
|
$(LTC): options.h
|
2004-06-01 02:46:09 +00:00
|
|
|
cd libtomcrypt && $(MAKE) clean && $(MAKE)
|
|
|
|
|
2004-07-27 16:30:46 +00:00
|
|
|
$(LTM): options.h
|
2004-06-01 02:46:09 +00:00
|
|
|
cd libtommath && $(MAKE)
|
|
|
|
|
|
|
|
ltc-clean:
|
|
|
|
cd libtomcrypt && $(MAKE) clean
|
|
|
|
|
|
|
|
ltm-clean:
|
|
|
|
cd libtommath && $(MAKE) clean
|
|
|
|
|
|
|
|
sizes: dropbear
|
|
|
|
objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
|
|
|
|
|
|
|
|
clean: ltc-clean ltm-clean
|
2004-07-27 13:32:54 +00:00
|
|
|
-rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress
|
|
|
|
-rm -f staticdropbear staticdropbearkey staticdropbearconvert staticscp
|
|
|
|
-rm -f dropbearmulti staticdropbearmulti
|
2004-06-01 02:46:09 +00:00
|
|
|
-rm -f *.o *.da *.bb *.bbg *.prof
|
|
|
|
|
|
|
|
distclean: clean tidy
|
2004-07-27 13:32:54 +00:00
|
|
|
-rm -f config.h
|
|
|
|
-rm -f Makefile
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
tidy:
|
|
|
|
-rm -f *~ *.gcov */*~
|