2004-07-27 13:32:54 +00:00
|
|
|
# This Makefile is for Dropbear SSH Server and Client
|
2005-01-02 17:08:27 +00:00
|
|
|
# @configure_input@
|
2004-07-27 13:32:54 +00:00
|
|
|
|
|
|
|
# invocation:
|
2017-06-27 14:42:32 +00:00
|
|
|
# make PROGRAMS="dropbear dbclient scp" MULTI=1 SCPPROGRESS=1
|
2004-07-27 13:32:54 +00:00
|
|
|
#
|
2017-06-27 14:42:32 +00:00
|
|
|
# to make a multiple-program binary "dropbearmulti".
|
2004-08-17 04:35:01 +00:00
|
|
|
# This example will include dropbear, scp, dropbearkey, dropbearconvert, and
|
|
|
|
# dbclient functionality, and includes the progress-bar functionality in scp.
|
2004-07-27 13:32:54 +00:00
|
|
|
|
|
|
|
ifndef PROGRAMS
|
2004-08-14 17:35:28 +00:00
|
|
|
PROGRAMS=dropbear dbclient dropbearkey dropbearconvert
|
2004-07-27 13:32:54 +00:00
|
|
|
endif
|
|
|
|
|
2014-02-18 13:03:27 +00:00
|
|
|
STATIC_LTC=libtomcrypt/libtomcrypt.a
|
|
|
|
STATIC_LTM=libtommath/libtommath.a
|
|
|
|
|
|
|
|
LIBTOM_LIBS=@LIBTOM_LIBS@
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2010-07-21 12:38:46 +00:00
|
|
|
ifeq (@BUNDLED_LIBTOM@, 1)
|
2014-02-18 13:03:27 +00:00
|
|
|
LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
|
2013-04-06 17:36:42 +00:00
|
|
|
CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
|
2017-07-20 19:38:26 +00:00
|
|
|
LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
|
2010-07-21 12:38:46 +00:00
|
|
|
endif
|
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
ifneq ($(wildcard localoptions.h),)
|
|
|
|
CFLAGS+=-DLOCALOPTIONS_H_EXISTS
|
2018-02-13 16:17:30 +00:00
|
|
|
LOCALOPTIONS_H=localoptions.h
|
2016-05-04 13:33:40 +00:00
|
|
|
endif
|
|
|
|
|
2016-03-17 15:21:33 +00:00
|
|
|
COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
|
2004-07-27 14:44:43 +00:00
|
|
|
dss.o bignum.o \
|
2013-11-14 14:05:47 +00:00
|
|
|
signkey.o rsa.o dbrandom.o \
|
2004-07-27 14:44:43 +00:00
|
|
|
queue.o \
|
2013-04-08 16:36:04 +00:00
|
|
|
atomicio.o compat.o fake-rfc2553.o \
|
2013-11-06 16:18:52 +00:00
|
|
|
ltc_prng.o ecc.o ecdsa.o crypto_desc.o \
|
|
|
|
gensignkey.o gendss.o genrsa.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2013-03-30 15:55:05 +00:00
|
|
|
SVROBJS=svr-kex.o svr-auth.o sshpty.o \
|
2008-09-08 15:14:02 +00:00
|
|
|
svr-authpasswd.o svr-authpubkey.o svr-authpubkeyoptions.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\
|
2011-02-25 12:14:33 +00:00
|
|
|
svr-tcpfwd.o svr-authpam.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2013-03-30 15:55:05 +00:00
|
|
|
CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
2013-03-31 13:38:17 +00:00
|
|
|
cli-session.o cli-runopts.o cli-chansession.o \
|
2009-07-01 04:53:17 +00:00
|
|
|
cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o \
|
2015-02-20 15:16:38 +00:00
|
|
|
cli-agentfwd.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 \
|
2016-01-14 13:54:58 +00:00
|
|
|
tcp-accept.o listener.o process-packet.o dh_groups.o \
|
2015-02-20 15:16:38 +00:00
|
|
|
common-runopts.o circbuffer.o curve25519-donna.o list.o netio.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2013-11-06 16:18:52 +00:00
|
|
|
KEYOBJS=dropbearkey.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
CONVERTOBJS=dropbearconvert.o keyimport.o
|
|
|
|
|
2009-09-02 15:05:14 +00:00
|
|
|
SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2014-02-06 23:57:45 +00:00
|
|
|
dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
|
2004-07-27 14:44:43 +00:00
|
|
|
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
|
|
|
|
2004-12-17 06:26:55 +00:00
|
|
|
VPATH=@srcdir@
|
|
|
|
srcdir=@srcdir@
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
prefix=@prefix@
|
2013-10-09 13:58:07 +00:00
|
|
|
exec_prefix=@exec_prefix@
|
2013-10-03 15:45:25 +00:00
|
|
|
datarootdir = @datarootdir@
|
|
|
|
bindir=@bindir@
|
|
|
|
sbindir=@sbindir@
|
|
|
|
mandir=@mandir@
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
CC=@CC@
|
|
|
|
AR=@AR@
|
|
|
|
RANLIB=@RANLIB@
|
|
|
|
STRIP=@STRIP@
|
|
|
|
INSTALL=@INSTALL@
|
2006-04-18 01:33:30 +00:00
|
|
|
CPPFLAGS=@CPPFLAGS@
|
2010-07-21 13:27:44 +00:00
|
|
|
CFLAGS+=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
|
2010-07-21 12:38:46 +00:00
|
|
|
LIBS+=@LIBS@
|
2004-06-01 02:46:09 +00:00
|
|
|
LDFLAGS=@LDFLAGS@
|
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
EXEEXT=@EXEEXT@
|
|
|
|
|
2017-06-27 14:37:46 +00:00
|
|
|
STATIC=@STATIC@
|
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
# 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
|
|
|
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
|
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-27 13:32:54 +00:00
|
|
|
ifeq ($(MULTI), 1)
|
2017-06-27 15:02:05 +00:00
|
|
|
TARGETS=dropbearmulti$(EXEEXT)
|
2004-07-27 13:32:54 +00:00
|
|
|
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 14:44:43 +00:00
|
|
|
all: $(TARGETS)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2018-02-13 16:17:30 +00:00
|
|
|
# a bit lazy, but safer
|
|
|
|
HEADERS=$(wildcard $(srcdir)/*.h *.h)
|
|
|
|
*.o: $(HEADERS)
|
|
|
|
|
2004-07-27 14:44:43 +00:00
|
|
|
strip: $(TARGETS)
|
2005-03-02 04:13:01 +00:00
|
|
|
$(STRIP) $(addsuffix $(EXEEXT), $(TARGETS))
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-09-21 12:14:20 +00:00
|
|
|
install: $(addprefix inst_, $(TARGETS))
|
2004-08-17 04:35:01 +00:00
|
|
|
|
2017-06-27 15:02:05 +00:00
|
|
|
insmultidropbear: dropbearmulti$(EXEEXT)
|
2013-10-03 15:45:25 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(sbindir)
|
2005-03-02 04:13:01 +00:00
|
|
|
-rm -f $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
|
2011-11-08 12:33:19 +00:00
|
|
|
-ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(sbindir)/dropbear$(EXEEXT)
|
2013-10-09 14:24:39 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(mandir)/man8
|
2015-01-23 14:59:30 +00:00
|
|
|
$(INSTALL) -m 644 $(srcdir)/dropbear.8 $(DESTDIR)$(mandir)/man8/dropbear.8
|
2004-08-17 04:35:01 +00:00
|
|
|
|
2017-06-27 15:02:05 +00:00
|
|
|
insmulti%: dropbearmulti$(EXEEXT)
|
2013-10-03 15:45:25 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(bindir)
|
2005-03-02 04:13:01 +00:00
|
|
|
-rm -f $(DESTDIR)$(bindir)/$*$(EXEEXT)
|
2011-11-08 12:33:19 +00:00
|
|
|
-ln -s $(bindir)/dropbearmulti$(EXEEXT) $(DESTDIR)$(bindir)/$*$(EXEEXT)
|
2013-10-09 14:24:39 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(mandir)/man1
|
2013-12-11 13:50:33 +00:00
|
|
|
if test -e $*.1; then $(INSTALL) -m 644 $*.1 $(DESTDIR)$(mandir)/man1/$*.1; fi
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2015-02-24 12:45:07 +00:00
|
|
|
# dropbear should go in sbin, so it needs a separate rule
|
2004-09-21 12:14:20 +00:00
|
|
|
inst_dropbear: dropbear
|
2013-10-03 15:45:25 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(sbindir)
|
|
|
|
$(INSTALL) dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(mandir)/man8
|
2015-01-23 14:59:30 +00:00
|
|
|
$(INSTALL) -m 644 $(srcdir)/dropbear.8 $(DESTDIR)$(mandir)/man8/dropbear.8
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2014-03-07 13:30:20 +00:00
|
|
|
inst_%: %
|
2013-10-03 15:45:25 +00:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(bindir)
|
|
|
|
$(INSTALL) $*$(EXEEXT) $(DESTDIR)$(bindir)
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(mandir)/man1
|
2013-10-09 14:24:39 +00:00
|
|
|
if test -e $*.1; then $(INSTALL) -m 644 $*.1 $(DESTDIR)$(mandir)/man1/$*.1; fi
|
|
|
|
|
|
|
|
inst_dropbearmulti: $(addprefix insmulti, $(PROGRAMS))
|
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
|
|
|
|
2014-02-06 23:57:45 +00:00
|
|
|
dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile
|
|
|
|
$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
|
|
|
|
|
|
|
|
dbclient: $(HEADERS) $(LIBTOM_DEPS) Makefile
|
2014-02-06 23:53:32 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS)
|
|
|
|
|
|
|
|
dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile
|
|
|
|
$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_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
|
2006-10-11 16:00:50 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@$(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)
|
2014-02-06 23:57:45 +00:00
|
|
|
MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
|
2004-07-27 14:44:43 +00:00
|
|
|
CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
|
2004-07-27 13:32:54 +00:00
|
|
|
endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2013-12-11 13:48:02 +00:00
|
|
|
dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile
|
2014-02-06 23:57:45 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $(MULTIOBJS) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
|
2004-08-17 04:35:01 +00:00
|
|
|
|
2013-12-11 13:48:02 +00:00
|
|
|
multibinary: dropbearmulti$(EXEEXT)
|
2004-08-17 04:35:01 +00:00
|
|
|
|
|
|
|
multilink: multibinary $(addprefix link, $(PROGRAMS))
|
|
|
|
|
|
|
|
link%:
|
2005-03-02 04:13:01 +00:00
|
|
|
-rm -f $*$(EXEEXT)
|
|
|
|
-ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2018-02-13 16:17:30 +00:00
|
|
|
$(STATIC_LTC):
|
2016-05-04 15:59:34 +00:00
|
|
|
$(MAKE) -C libtomcrypt
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2018-02-13 16:17:30 +00:00
|
|
|
$(STATIC_LTM):
|
2016-05-04 15:59:34 +00:00
|
|
|
$(MAKE) -C libtommath
|
2016-05-04 13:33:40 +00:00
|
|
|
|
2006-10-11 16:00:50 +00:00
|
|
|
.PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
ltc-clean:
|
2016-05-04 15:59:34 +00:00
|
|
|
$(MAKE) -C libtomcrypt clean
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
ltm-clean:
|
2016-05-04 15:59:34 +00:00
|
|
|
$(MAKE) -C libtommath clean
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
sizes: dropbear
|
|
|
|
objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
|
|
|
|
|
2004-08-17 10:40:31 +00:00
|
|
|
clean: ltc-clean ltm-clean thisclean
|
|
|
|
|
|
|
|
thisclean:
|
2017-06-27 15:02:05 +00:00
|
|
|
-rm -f dropbear$(EXEEXT) dbclient$(EXEEXT) dropbearkey$(EXEEXT) \
|
|
|
|
dropbearconvert$(EXEEXT) scp$(EXEEXT) scp-progress$(EXEEXT) \
|
|
|
|
dropbearmulti$(EXEEXT) *.o *.da *.bb *.bbg *.prof
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
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 */*~
|
2016-05-04 13:33:40 +00:00
|
|
|
|
2016-05-04 15:59:34 +00:00
|
|
|
# default_options.h is stored in version control, could not find a workaround
|
|
|
|
# for parallel "make -j" and dependency rules.
|
2016-05-04 13:33:40 +00:00
|
|
|
default_options.h: default_options.h.in
|
2018-02-13 16:17:30 +00:00
|
|
|
@echo Creating $@
|
|
|
|
@echo "/*\n > > > Do not edit this file (default_options.h) < < <\nGenerated from "$^"\nLocal customisation goes in localoptions.h\n*/\n\n" > $@.tmp
|
|
|
|
@$(srcdir)/ifndef_wrapper.sh < $^ >> $@.tmp
|
|
|
|
@mv $@.tmp $@
|