mirror of
https://github.com/clearml/dropbear
synced 2025-03-09 21:41:07 +00:00
Switching to the magical new Makefile, and new dbmulti style
--HG-- extra : convert_revision : 3f8efcdd56aab197d30a1ea81527c37dfee2f928
This commit is contained in:
parent
58baa046d2
commit
8b6ddcb066
69
Makefile.in
69
Makefile.in
@ -10,18 +10,17 @@
|
|||||||
# This makefile is quite evil.
|
# This makefile is quite evil.
|
||||||
|
|
||||||
ifndef PROGRAMS
|
ifndef PROGRAMS
|
||||||
PROGRAMS="dropbear dbclient dropbearkey dropbearmulti"
|
PROGRAMS=dropbear dbclient dropbearkey dropbearmulti
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LTC=libtomcrypt/libtomcrypt.a
|
LTC=libtomcrypt/libtomcrypt.a
|
||||||
LTM=libtommath/libtommath.a
|
LTM=libtommath/libtommath.a
|
||||||
|
|
||||||
COMMONOBJS=dbutil.o common-session.o packet.o common-algo.o buffer.o \
|
COMMONOBJS=dbutil.o buffer.o \
|
||||||
common-kex.o dss.o bignum.o \
|
dss.o bignum.o \
|
||||||
signkey.o rsa.o random.o common-channel.o \
|
signkey.o rsa.o random.o \
|
||||||
common-chansession.o queue.o termcodes.o \
|
queue.o \
|
||||||
loginrec.o atomicio.o tcpfwd-direct.o compat.o \
|
atomicio.o compat.o
|
||||||
tcpfwd-remote.o listener.o process-packet.o common-runopts.o
|
|
||||||
|
|
||||||
SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
|
SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
|
||||||
svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \
|
svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \
|
||||||
@ -30,9 +29,12 @@ SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
|
|||||||
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
||||||
cli-session.o cli-service.o
|
cli-session.o cli-service.o
|
||||||
|
|
||||||
DROPBEAROBJS=
|
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
|
||||||
|
common-channel.o common-chansession.o termcodes.o loginrec.o \
|
||||||
|
tcpfwd-direct.o tcpfwd-remote.o listener.o process-packet.o \
|
||||||
|
common-runopts.o
|
||||||
|
|
||||||
DROPBEARKEYOBJS=dropbearkey.o gendss.o genrsa.o
|
KEYOBJS=dropbearkey.o gendss.o genrsa.o
|
||||||
|
|
||||||
CONVERTOBJS=dropbearconvert.o keyimport.o
|
CONVERTOBJS=dropbearconvert.o keyimport.o
|
||||||
|
|
||||||
@ -45,8 +47,8 @@ HEADERS=options.h dbutil.h session.h packet.h algo.h ssh.h buffer.h kex.h \
|
|||||||
loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd-direct.h compat.h \
|
loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd-direct.h compat.h \
|
||||||
tcpfwd-remote.h listener.h
|
tcpfwd-remote.h listener.h
|
||||||
|
|
||||||
dropbearobjs=$(COMMONOBJS) $(SVROBJS)
|
dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
|
||||||
dbclientobjs=$(COMMONOBJS) $(CLIOBJS)
|
dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
|
||||||
dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
|
dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
|
||||||
dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
|
dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
|
||||||
scpobjs=$(SCPOBJS)
|
scpobjs=$(SCPOBJS)
|
||||||
@ -57,7 +59,7 @@ bindir=${exec_prefix}/bin
|
|||||||
sbindir=${exec_prefix}/sbin
|
sbindir=${exec_prefix}/sbin
|
||||||
|
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
LD=@CC@
|
LD=@LD@
|
||||||
AR=@AR@
|
AR=@AR@
|
||||||
RANLIB=@RANLIB@
|
RANLIB=@RANLIB@
|
||||||
STRIP=@STRIP@
|
STRIP=@STRIP@
|
||||||
@ -69,17 +71,15 @@ LDFLAGS=@LDFLAGS@
|
|||||||
EXEEXT=@EXEEXT@
|
EXEEXT=@EXEEXT@
|
||||||
|
|
||||||
# whether we're building client, server, or both for the common objects.
|
# whether we're building client, server, or both for the common objects.
|
||||||
space:= $(empty) $(empty)
|
|
||||||
CLISVRFLAGS=
|
|
||||||
# evilness so we detect 'dropbear' by itself as a word
|
# evilness so we detect 'dropbear' by itself as a word
|
||||||
ifneq (,$(findstring $(space)dropbear$(space), $(space)$(PROGRAMS)$(space)))
|
space:= $(empty) $(empty)
|
||||||
CLISVRFLAGS+= -DDROPBEAR_SERVER
|
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
|
||||||
|
CFLAGS+= -DDROPBEAR_SERVER
|
||||||
endif
|
endif
|
||||||
ifneq (,$(findstring $(space)dbclient$(space), $(space)$(PROGRAMS)$(space)))
|
ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
|
||||||
CLISVRFLAGS+= -DDROPBEAR_CLIENT
|
CFLAGS+= -DDROPBEAR_CLIENT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS+=$(CLISVRFLAGS)
|
|
||||||
|
|
||||||
# these are exported so that libtomcrypt's makefile will use them
|
# these are exported so that libtomcrypt's makefile will use them
|
||||||
export CC
|
export CC
|
||||||
@ -108,12 +108,15 @@ endif
|
|||||||
#%: $(HEADERS) Makefile
|
#%: $(HEADERS) Makefile
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
test:
|
||||||
|
@echo Z$(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))Z
|
||||||
|
|
||||||
strip: $(TARGETS)
|
strip: $(TARGETS)
|
||||||
$(STRIP) $(foreach prog, $(TARGETS), $(SPREFIX)$(prog)$(EXEEXT))
|
$(STRIP) $(addsuffix $(EXEEXT), $(addprefix $(SPREFIX), $(TARGETS)))
|
||||||
|
|
||||||
|
install: $(addprefix install, $(TARGETS))
|
||||||
install: $(foreach prog, $(TARGETS), install$prog)
|
|
||||||
|
|
||||||
# dropbear should go in sbin, so it needs a seperate rule
|
# dropbear should go in sbin, so it needs a seperate rule
|
||||||
installdropbear: dropbear
|
installdropbear: dropbear
|
||||||
@ -128,33 +131,39 @@ install%: $*
|
|||||||
-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
||||||
-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
||||||
ifeq ($(MULTI), 1)
|
ifeq ($(MULTI), 1)
|
||||||
|
@echo
|
||||||
@echo "You must manually create links for $*"
|
@echo "You must manually create links for $*"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# The actual binaries
|
# for some reason the rule further down doesn't like $($@objs) as a prereq.
|
||||||
dropbear: $(dropbearobjs)
|
dropbear: $(dropbearobjs)
|
||||||
|
dbclient: $(dbclientobjs)
|
||||||
|
dropbearkey: $(dropbearkeyobjs)
|
||||||
|
dropbearconvert: $(dropbearconvertobjs)
|
||||||
|
|
||||||
dropbear dbclient dropbearkey dropbearconvert: $($($@objs)) $(HEADERS) \
|
dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM)
|
||||||
$(LTC) $(LTM)
|
|
||||||
@echo $(CLISVRFLAGS)
|
|
||||||
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS)
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS)
|
||||||
|
|
||||||
|
|
||||||
# scp doesn't use the libs so is special.
|
# scp doesn't use the libs so is special.
|
||||||
scp: $(SCPOBJS) $(HEADERS)
|
scp: $(SCPOBJS) $(HEADERS)
|
||||||
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS)
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS)
|
||||||
|
|
||||||
|
|
||||||
MULTIOBJS=dbmulti.o
|
# multi-binary compilation.
|
||||||
|
MULTIOBJS=
|
||||||
ifeq ($(MULTI),1)
|
ifeq ($(MULTI),1)
|
||||||
deftarget=multi
|
MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
|
||||||
MULTIOBJS=$(foreach prog, $(PROGRAMS), $($(prog)objs))
|
CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
testfoo:
|
||||||
|
echo $(MULTIOBJS)
|
||||||
|
|
||||||
dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM)
|
dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM)
|
||||||
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS)
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS)
|
||||||
|
@echo
|
||||||
@echo "You should now create symlinks to the programs you have included"
|
@echo "You should now create symlinks to the programs you have included"
|
||||||
@echo "ie 'ln -s dropbearmulti dropbear'"
|
@echo "ie 'ln -s dropbearmulti dropbear'"
|
||||||
|
|
||||||
|
21
dbmulti.c
21
dbmulti.c
@ -4,6 +4,7 @@
|
|||||||
int dropbear_main(int argc, char ** argv);
|
int dropbear_main(int argc, char ** argv);
|
||||||
int dropbearkey_main(int argc, char ** argv);
|
int dropbearkey_main(int argc, char ** argv);
|
||||||
int dropbearconvert_main(int argc, char ** argv);
|
int dropbearconvert_main(int argc, char ** argv);
|
||||||
|
int scp_main(int argc, char ** argv);
|
||||||
|
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
|
|
||||||
@ -13,33 +14,41 @@ int main(int argc, char ** argv) {
|
|||||||
/* figure which form we're being called as */
|
/* figure which form we're being called as */
|
||||||
progname = basename(argv[0]);
|
progname = basename(argv[0]);
|
||||||
|
|
||||||
#ifdef DBMULTI_DROPBEAR
|
#ifdef DBMULTI_dropbear
|
||||||
if (strcmp(progname, "dropbear") == 0) {
|
if (strcmp(progname, "dropbear") == 0) {
|
||||||
return dropbear_main(argc, argv);
|
return dropbear_main(argc, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef DBMULTI_KEY
|
#ifdef DBMULTI_dropbearkey
|
||||||
if (strcmp(progname, "dropbearkey") == 0) {
|
if (strcmp(progname, "dropbearkey") == 0) {
|
||||||
return dropbearkey_main(argc, argv);
|
return dropbearkey_main(argc, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef DBMULTI_CONVERT
|
#ifdef DBMULTI_dropbearconvert
|
||||||
if (strcmp(progname, "dropbearconvert") == 0) {
|
if (strcmp(progname, "dropbearconvert") == 0) {
|
||||||
return dropbearconvert_main(argc, argv);
|
return dropbearconvert_main(argc, argv);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef DBMULTI_scp
|
||||||
|
if (strcmp(progname, "scp") == 0) {
|
||||||
|
return scp_main(argc, argv);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Dropbear multi-purpose version %s\n"
|
fprintf(stderr, "Dropbear multi-purpose version %s\n"
|
||||||
"Make a symlink pointing at this binary with one of the following names:\n"
|
"Make a symlink pointing at this binary with one of the following names:\n"
|
||||||
#ifdef DBMULTI_DROPBEAR
|
#ifdef DBMULTI_dropbear
|
||||||
"'dropbear' - the Dropbear server\n"
|
"'dropbear' - the Dropbear server\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef DBMULTI_KEY
|
#ifdef DBMULTI_dropbearkey
|
||||||
"'dropbearkey' - the key generator\n"
|
"'dropbearkey' - the key generator\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef DBMULTI_CONVERT
|
#ifdef DBMULTI_dropbearconvert
|
||||||
"'dropbearconvert' - the key converter\n"
|
"'dropbearconvert' - the key converter\n"
|
||||||
|
#endif
|
||||||
|
#ifdef DBMULTI_scp
|
||||||
|
"'scp' - secure copy\n"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
DROPBEAR_VERSION);
|
DROPBEAR_VERSION);
|
||||||
|
@ -53,8 +53,8 @@ static void printhelp(char * progname) {
|
|||||||
"standard input or standard output.\n", progname);
|
"standard input or standard output.\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DBMULTI_CONVERT) || !defined(DROPBEAR_MULTI)
|
#if defined(DBMULTI_dropbearconvert) || !defined(DROPBEAR_MULTI)
|
||||||
#if defined(DBMULTI_CONVERT) && defined(DROPBEAR_MULTI)
|
#if defined(DBMULTI_dropbearconvert) && defined(DROPBEAR_MULTI)
|
||||||
int dropbearconvert_main(int argc, char ** argv) {
|
int dropbearconvert_main(int argc, char ** argv) {
|
||||||
#else
|
#else
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
|
@ -80,8 +80,8 @@ static void printhelp(char * progname) {
|
|||||||
progname);
|
progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DBMULTI_KEY) || !defined(DROPBEAR_MULTI)
|
#if defined(DBMULTI_dropbearkey) || !defined(DROPBEAR_MULTI)
|
||||||
#if defined(DBMULTI_KEY) && defined(DROPBEAR_MULTI)
|
#if defined(DBMULTI_dropbearkey) && defined(DROPBEAR_MULTI)
|
||||||
int dropbearkey_main(int argc, char ** argv) {
|
int dropbearkey_main(int argc, char ** argv) {
|
||||||
#else
|
#else
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
|
@ -36,8 +36,8 @@ static void sigintterm_handler(int fish);
|
|||||||
|
|
||||||
static int childpipes[MAX_UNAUTH_CLIENTS];
|
static int childpipes[MAX_UNAUTH_CLIENTS];
|
||||||
|
|
||||||
#if defined(DBMULTI_DROPBEAR) || !defined(DROPBEAR_MULTI)
|
#if defined(DBMULTI_dropbear) || !defined(DROPBEAR_MULTI)
|
||||||
#if defined(DBMULTI_DROPBEAR) && defined(DROPBEAR_MULTI)
|
#if defined(DBMULTI_dropbear) && defined(DROPBEAR_MULTI)
|
||||||
int dropbear_main(int argc, char ** argv)
|
int dropbear_main(int argc, char ** argv)
|
||||||
#else
|
#else
|
||||||
int main(int argc, char ** argv)
|
int main(int argc, char ** argv)
|
Loading…
Reference in New Issue
Block a user