Mercurial > dropbear
view Makefile.in @ 29:0fcf63e1cb01
Totally reworked Makefile.in
Doesn't totally work, but getting there
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 27 Jul 2004 13:32:54 +0000 |
parents | 469950e86d0f |
children | 223b0f5f8dce |
line wrap: on
line source
# 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 LTM=libtommath/libtommath.a COMMONOBJS=dbutil.o common-session.o packet.o common-algo.o buffer.o \ common-kex.o dss.o bignum.o \ signkey.o rsa.o random.o common-channel.o \ common-chansession.o queue.o termcodes.o \ loginrec.o atomicio.o tcpfwd-direct.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 \ svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \ svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \ cli-session.o cli-service.o DROPBEAROBJS= DROPBEARKEYOBJS=dropbearkey.o gendss.o genrsa.o 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 \ dss.h bignum.h signkey.h rsa.h random.h service.h auth.h authpasswd.h \ debug.h channel.h chansession.h config.h queue.h sshpty.h \ termcodes.h gendss.h genrsa.h authpubkey.h runopts.h includes.h \ loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd-direct.h compat.h \ tcpfwd-remote.h listener.h dropbearobjs=$(COMMONOBJS) $(SVROBJS) dbclientobjs=$(COMMONOBJS) $(CLIOBJS) dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS) dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS) scpobjs=$(SCPOBJS) prefix=@prefix@ exec_prefix=${prefix} bindir=${exec_prefix}/bin sbindir=${exec_prefix}/sbin CC=@CC@ LD=@CC@ AR=@AR@ RANLIB=@RANLIB@ STRIP=@STRIP@ INSTALL=@INSTALL@ CFLAGS=@CFLAGS@ LIBS=$(LTC) $(LTM) @LIBS@ 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 export CC export CFLAGS export RANLIB AR STRIP ifeq ($(STATIC), 1) LDFLAGS+=-static SPREFIX=static else SPREFIX= endif ifeq ($(MULTI), 1) TARGETS=dropbearmulti else TARGETS=$(PROGRAMS) endif # 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) -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) -m 755 $(SPREFIX)$*$(EXEEXT) $(DESTDIR)$(bindir) -chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT) -chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT) ifeq ($(MULTI), 1) @echo "You must manually create links for $*" endif # The actual binaries dropbear: $(dropbearobjs) dropbear dbclient dropbearkey dropbearconvert: $($($@objs)) $(HEADERS) \ $(LTC) $(LTM) @echo $(CLISVRFLAGS) $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS) # scp doesn't use the libs so is special. scp: $(SCPOBJS) $(HEADERS) $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS) MULTIOBJS=dbmulti.o ifeq ($(MULTI),1) deftarget=multi MULTIOBJS=$(foreach prog, $(PROGRAMS), $($(prog)objs)) endif dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM) $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS) @echo "You should now create symlinks to the programs you have included" @echo "ie 'ln -s dropbearmulti dropbear'" $(LTC): $(HEADERS) cd libtomcrypt && $(MAKE) clean && $(MAKE) $(LTM): $(HEADERS) 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 -rm -f dropbear dbclient dropbearkey dropbearconvert scp scp-progress -rm -f staticdropbear staticdropbearkey staticdropbearconvert staticscp -rm -f dropbearmulti staticdropbearmulti -rm -f *.o *.da *.bb *.bbg *.prof distclean: clean tidy -rm -f config.h -rm -f Makefile tidy: -rm -f *~ *.gcov */*~