mirror of
https://github.com/clearml/dropbear
synced 2025-02-11 23:23:30 +00:00
Totally reworked Makefile.in
Doesn't totally work, but getting there --HG-- extra : convert_revision : 517f94c41885417c1040a6a6cf14aa2248334f26
This commit is contained in:
parent
187317c2c9
commit
58baa046d2
183
Makefile.in
183
Makefile.in
@ -1,22 +1,36 @@
|
|||||||
|
# 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
|
||||||
|
PROGRAMS="dropbear dbclient dropbearkey dropbearmulti"
|
||||||
|
endif
|
||||||
|
|
||||||
LTC=libtomcrypt/libtomcrypt.a
|
LTC=libtomcrypt/libtomcrypt.a
|
||||||
LTM=libtommath/libtommath.a
|
LTM=libtommath/libtommath.a
|
||||||
|
|
||||||
COMMONOBJS=dbutil.o common-session.o common-packet.o common-algo.o buffer.o \
|
COMMONOBJS=dbutil.o common-session.o packet.o common-algo.o buffer.o \
|
||||||
common-kex.o dss.o bignum.o \
|
common-kex.o dss.o bignum.o \
|
||||||
signkey.o rsa.o random.o common-channel.o \
|
signkey.o rsa.o random.o common-channel.o \
|
||||||
common-chansession.o queue.o termcodes.o \
|
common-chansession.o queue.o termcodes.o \
|
||||||
loginrec.o atomicio.o svr-x11fwd.o tcpfwd-direct.o compat.o \
|
loginrec.o atomicio.o tcpfwd-direct.o compat.o \
|
||||||
tcpfwd-remote.o listener.o process-packet.o common-runopts.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 \
|
||||||
svr-chansession.o svr-runopts.o svr-agentfwd.o
|
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o
|
||||||
|
|
||||||
CLIOBJS=
|
CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
|
||||||
|
cli-session.o cli-service.o
|
||||||
|
|
||||||
OBJS=$(COMMONOBJS) $(SVROBJS)
|
DROPBEAROBJS=
|
||||||
|
|
||||||
DROPBEAROBJS=main.o
|
|
||||||
|
|
||||||
DROPBEARKEYOBJS=dropbearkey.o gendss.o genrsa.o
|
DROPBEARKEYOBJS=dropbearkey.o gendss.o genrsa.o
|
||||||
|
|
||||||
@ -31,7 +45,11 @@ 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
|
||||||
|
|
||||||
ALLOBJS=$(OBJS) $(DROPBEARKEYOBJS) $(DROPBEAROBJS)
|
dropbearobjs=$(COMMONOBJS) $(SVROBJS)
|
||||||
|
dbclientobjs=$(COMMONOBJS) $(CLIOBJS)
|
||||||
|
dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
|
||||||
|
dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
|
||||||
|
scpobjs=$(SCPOBJS)
|
||||||
|
|
||||||
prefix=@prefix@
|
prefix=@prefix@
|
||||||
exec_prefix=${prefix}
|
exec_prefix=${prefix}
|
||||||
@ -44,98 +62,102 @@ AR=@AR@
|
|||||||
RANLIB=@RANLIB@
|
RANLIB=@RANLIB@
|
||||||
STRIP=@STRIP@
|
STRIP=@STRIP@
|
||||||
INSTALL=@INSTALL@
|
INSTALL=@INSTALL@
|
||||||
CFLAGS=-Ilibtomcrypt @CFLAGS@
|
CFLAGS=@CFLAGS@
|
||||||
LIBS=$(LTC) $(LTM) @LIBS@
|
LIBS=$(LTC) $(LTM) @LIBS@
|
||||||
LDFLAGS=@LDFLAGS@
|
LDFLAGS=@LDFLAGS@
|
||||||
|
|
||||||
|
EXEEXT=@EXEEXT@
|
||||||
|
|
||||||
|
# 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
|
||||||
|
ifneq (,$(findstring $(space)dropbear$(space), $(space)$(PROGRAMS)$(space)))
|
||||||
|
CLISVRFLAGS+= -DDROPBEAR_SERVER
|
||||||
|
endif
|
||||||
|
ifneq (,$(findstring $(space)dbclient$(space), $(space)$(PROGRAMS)$(space)))
|
||||||
|
CLISVRFLAGS+= -DDROPBEAR_CLIENT
|
||||||
|
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
|
||||||
export CFLAGS
|
export CFLAGS
|
||||||
export RANLIB AR STRIP
|
export RANLIB AR STRIP
|
||||||
|
|
||||||
all: dropbear dropbearkey dropbearconvert
|
ifeq ($(STATIC), 1)
|
||||||
@echo
|
LDFLAGS+=-static
|
||||||
@echo Run \"make strip\" if you want stripped binaries,
|
SPREFIX=static
|
||||||
@echo or \"make install\" to install to ${prefix}
|
else
|
||||||
|
SPREFIX=
|
||||||
|
endif
|
||||||
|
|
||||||
strip:
|
ifeq ($(MULTI), 1)
|
||||||
-$(STRIP) dropbear
|
TARGETS=dropbearmulti
|
||||||
-$(STRIP) dropbearkey
|
else
|
||||||
-$(STRIP) dropbearconvert
|
TARGETS=$(PROGRAMS)
|
||||||
|
endif
|
||||||
|
|
||||||
install: all
|
# for the scp progress meter. The -D doesn't affect anything else.
|
||||||
|
ifeq ($(SCPPROGRESS), 1)
|
||||||
|
CFLAGS+=-DPROGRESS_METER
|
||||||
|
endif
|
||||||
|
|
||||||
|
#%: $(HEADERS)
|
||||||
|
#%: $(HEADERS) Makefile
|
||||||
|
# TODO
|
||||||
|
|
||||||
|
|
||||||
|
strip: $(TARGETS)
|
||||||
|
$(STRIP) $(foreach prog, $(TARGETS), $(SPREFIX)$(prog)$(EXEEXT))
|
||||||
|
|
||||||
|
|
||||||
|
install: $(foreach prog, $(TARGETS), install$prog)
|
||||||
|
|
||||||
|
# dropbear should go in sbin, so it needs a seperate rule
|
||||||
|
installdropbear: dropbear
|
||||||
$(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
|
$(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)
|
||||||
|
|
||||||
|
install%: $*
|
||||||
$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
|
$(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
|
||||||
$(INSTALL) -m 755 dropbear $(DESTDIR)$(sbindir)
|
$(INSTALL) -m 755 $(SPREFIX)$*$(EXEEXT) $(DESTDIR)$(bindir)
|
||||||
$(INSTALL) -m 755 dropbearkey $(DESTDIR)$(bindir)
|
-chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
||||||
$(INSTALL) -m 755 dropbearconvert $(DESTDIR)$(bindir)
|
-chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
|
||||||
# chown might fail, so do it separately to the install
|
ifeq ($(MULTI), 1)
|
||||||
-chown root $(DESTDIR)$(sbindir)/dropbear
|
@echo "You must manually create links for $*"
|
||||||
-chgrp 0 $(DESTDIR)$(sbindir)/dropbear
|
endif
|
||||||
-chown root $(DESTDIR)$(bindir)/dropbearkey
|
|
||||||
-chgrp 0 $(DESTDIR)$(bindir)/dropbearkey
|
|
||||||
-chown root $(DESTDIR)$(bindir)/dropbearconvert
|
|
||||||
-chgrp 0 $(DESTDIR)$(bindir)/dropbearconvert
|
|
||||||
|
|
||||||
|
|
||||||
static: dropbear-static dropbearkey-static dropbearconvert-static
|
|
||||||
|
|
||||||
$(ALLOBJS): $(HEADERS) Makefile
|
# The actual binaries
|
||||||
|
dropbear: $(dropbearobjs)
|
||||||
|
|
||||||
dropbear: $(DROPBEAROBJS) $(OBJS) $(HEADERS) Makefile $(LTC) $(LTM)
|
dropbear dbclient dropbearkey dropbearconvert: $($($@objs)) $(HEADERS) \
|
||||||
$(LD) $(LDFLAGS) -o dropbear $(DROPBEAROBJS) $(OBJS) $(LIBS)
|
$(LTC) $(LTM)
|
||||||
|
@echo $(CLISVRFLAGS)
|
||||||
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS)
|
||||||
|
|
||||||
dropbear-static: $(DROPBEAROBJS) $(OBJS) $(HEADERS) Makefile $(LTC) $(LTM)
|
|
||||||
$(LD) $(LDFLAGS) -o staticdropbear $(DROPBEAROBJS) $(OBJS) $(LIBS) -static
|
|
||||||
|
|
||||||
dropbearkey: $(OBJS) $(HEADERS) Makefile $(DROPBEARKEYOBJS) $(LTC) $(LTM)
|
# scp doesn't use the libs so is special.
|
||||||
$(LD) $(LDFLAGS) -o dropbearkey $(DROPBEARKEYOBJS) \
|
scp: $(SCPOBJS) $(HEADERS)
|
||||||
$(OBJS) $(LIBS)
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS)
|
||||||
|
|
||||||
dropbearkey-static: $(OBJS) $(HEADERS) Makefile $(DROPBEARKEYOBJS) $(LTC) $(LTM)
|
|
||||||
$(LD) $(LDFLAGS) -o staticdropbearkey $(DROPBEARKEYOBJS) \
|
|
||||||
$(OBJS) $(LIBS) -static
|
|
||||||
|
|
||||||
dropbearconvert: $(OBJS) $(HEADERS) Makefile $(CONVERTOBJS) $(LTC) $(LTM)
|
MULTIOBJS=dbmulti.o
|
||||||
$(LD) $(LDFLAGS) -o dropbearconvert $(CONVERTOBJS) $(OBJS) $(LIBS)
|
ifeq ($(MULTI),1)
|
||||||
|
deftarget=multi
|
||||||
|
MULTIOBJS=$(foreach prog, $(PROGRAMS), $($(prog)objs))
|
||||||
|
endif
|
||||||
|
|
||||||
dropbearconvert-static: $(OBJS) $(HEADERS) Makefile $(CONVERTOBJS) $(LTC) $(LTM)
|
dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM)
|
||||||
$(LD) $(LDFLAGS) -o staticdropbearconvert $(CONVERTOBJS) $(OBJS) $(LIBS) \
|
$(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS)
|
||||||
-static
|
|
||||||
|
|
||||||
multi: dropbearmulti
|
|
||||||
|
|
||||||
dropbearmulti: $(HEADERS) $(OBJS) $(LTC) $(LTM) $(CONVERTOBJS) \
|
|
||||||
$(DROPBEARKEYOBJS) $(DROPBEAROBJS) dbmulti.o
|
|
||||||
$(LD) $(LDFLAGS) -o dropbearmulti $(OBJS) $(LTM) $(LTM) $(CONVERTOBJS) \
|
|
||||||
$(DROPBEARKEYOBJS) $(DROPBEAROBJS) dbmulti.o $(LIBS)
|
|
||||||
@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'"
|
||||||
|
|
||||||
dropbearmultistatic: $(HEADERS) $(OBJS) $(LTC) $(LTM) $(CONVERTOBJS) \
|
|
||||||
$(DROPBEARKEYOBJS) $(DROPBEAROBJS) dbmulti.o
|
|
||||||
$(LD) $(LDFLAGS) -o staticdropbearmulti $(OBJS) $(LTM) $(LTM) \
|
|
||||||
$(CONVERTOBJS) $(DROPBEARKEYOBJS) $(DROPBEAROBJS) \
|
|
||||||
dbmulti.o $(LIBS) -static
|
|
||||||
@echo "You should now create symlinks to the programs you have included"
|
|
||||||
@echo "ie 'ln -s dropbearmultistatic dropbear'"
|
|
||||||
|
|
||||||
stripmulti: dropbearmulti
|
|
||||||
-$(STRIP) dropbearmulti
|
|
||||||
|
|
||||||
|
|
||||||
scp: $(SCPOBJS) Makefile
|
|
||||||
$(LD) $(LDFLAGS) -o $@ $(SCPOBJS)
|
|
||||||
|
|
||||||
# gnumake before 3.80 is broken. So this is uglyish
|
|
||||||
scp-progress: atomicio.o scpmisc.o $(HEADERS) Makefile
|
|
||||||
-rm scp.o progressmeter.o
|
|
||||||
$(MAKE) CFLAGS="$(CFLAGS) -DPROGRESS_METER" scp.o progressmeter.o
|
|
||||||
$(LD) $(LDFLAGS) -o $@ $(SCPOBJS)
|
|
||||||
|
|
||||||
scpstatic: $(SCPOBJS) $(HEADERS) Makefile
|
|
||||||
$(LD) $(LDFLAGS) -o $@ $(SCPOBJS) -static
|
|
||||||
|
|
||||||
$(LTC): $(HEADERS)
|
$(LTC): $(HEADERS)
|
||||||
cd libtomcrypt && $(MAKE) clean && $(MAKE)
|
cd libtomcrypt && $(MAKE) clean && $(MAKE)
|
||||||
|
|
||||||
@ -152,13 +174,14 @@ sizes: dropbear
|
|||||||
objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
|
objdump -t dropbear|grep ".text"|cut -d "." -f 2|sort -rn
|
||||||
|
|
||||||
clean: ltc-clean ltm-clean
|
clean: ltc-clean ltm-clean
|
||||||
-rm -f dropbear dropbear dropbearkey staticdropbear staticdropbearkey
|
-rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress
|
||||||
-rm -f dropbearconvert staticdropbearconvert scp scp-progress scpstatic
|
-rm -f staticdropbear staticdropbearkey staticdropbearconvert staticscp
|
||||||
-rm -f dropbearmulti dropbearmultistatic
|
-rm -f dropbearmulti staticdropbearmulti
|
||||||
-rm -f *.o *.da *.bb *.bbg *.prof
|
-rm -f *.o *.da *.bb *.bbg *.prof
|
||||||
|
|
||||||
distclean: clean tidy
|
distclean: clean tidy
|
||||||
-rm -f Makefile config.h
|
-rm -f config.h
|
||||||
|
-rm -f Makefile
|
||||||
|
|
||||||
tidy:
|
tidy:
|
||||||
-rm -f *~ *.gcov */*~
|
-rm -f *~ *.gcov */*~
|
||||||
|
Loading…
Reference in New Issue
Block a user