comparison Makefile.in @ 30:223b0f5f8dce

Switching to the magical new Makefile, and new dbmulti style
author Matt Johnston <matt@ucc.asn.au>
date Tue, 27 Jul 2004 14:44:43 +0000
parents 0fcf63e1cb01
children 3c2066e196a9
comparison
equal deleted inserted replaced
29:0fcf63e1cb01 30:223b0f5f8dce
8 # progress-bar functionality in scp. Hopefully that seems intuitive. 8 # progress-bar functionality in scp. Hopefully that seems intuitive.
9 9
10 # This makefile is quite evil. 10 # This makefile is quite evil.
11 11
12 ifndef PROGRAMS 12 ifndef PROGRAMS
13 PROGRAMS="dropbear dbclient dropbearkey dropbearmulti" 13 PROGRAMS=dropbear dbclient dropbearkey dropbearmulti
14 endif 14 endif
15 15
16 LTC=libtomcrypt/libtomcrypt.a 16 LTC=libtomcrypt/libtomcrypt.a
17 LTM=libtommath/libtommath.a 17 LTM=libtommath/libtommath.a
18 18
19 COMMONOBJS=dbutil.o common-session.o packet.o common-algo.o buffer.o \ 19 COMMONOBJS=dbutil.o buffer.o \
20 common-kex.o dss.o bignum.o \ 20 dss.o bignum.o \
21 signkey.o rsa.o random.o common-channel.o \ 21 signkey.o rsa.o random.o \
22 common-chansession.o queue.o termcodes.o \ 22 queue.o \
23 loginrec.o atomicio.o tcpfwd-direct.o compat.o \ 23 atomicio.o compat.o
24 tcpfwd-remote.o listener.o process-packet.o common-runopts.o
25 24
26 SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \ 25 SVROBJS=svr-kex.o svr-algo.o svr-auth.o sshpty.o \
27 svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \ 26 svr-authpasswd.o svr-authpubkey.o svr-session.o svr-service.o \
28 svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o 27 svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o
29 28
30 CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \ 29 CLIOBJS=cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
31 cli-session.o cli-service.o 30 cli-session.o cli-service.o
32 31
33 DROPBEAROBJS= 32 CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
33 common-channel.o common-chansession.o termcodes.o loginrec.o \
34 tcpfwd-direct.o tcpfwd-remote.o listener.o process-packet.o \
35 common-runopts.o
34 36
35 DROPBEARKEYOBJS=dropbearkey.o gendss.o genrsa.o 37 KEYOBJS=dropbearkey.o gendss.o genrsa.o
36 38
37 CONVERTOBJS=dropbearconvert.o keyimport.o 39 CONVERTOBJS=dropbearconvert.o keyimport.o
38 40
39 SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o 41 SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o
40 42
43 debug.h channel.h chansession.h config.h queue.h sshpty.h \ 45 debug.h channel.h chansession.h config.h queue.h sshpty.h \
44 termcodes.h gendss.h genrsa.h authpubkey.h runopts.h includes.h \ 46 termcodes.h gendss.h genrsa.h authpubkey.h runopts.h includes.h \
45 loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd-direct.h compat.h \ 47 loginrec.h atomicio.h x11fwd.h agentfwd.h tcpfwd-direct.h compat.h \
46 tcpfwd-remote.h listener.h 48 tcpfwd-remote.h listener.h
47 49
48 dropbearobjs=$(COMMONOBJS) $(SVROBJS) 50 dropbearobjs=$(COMMONOBJS) $(CLISVROBJS) $(SVROBJS)
49 dbclientobjs=$(COMMONOBJS) $(CLIOBJS) 51 dbclientobjs=$(COMMONOBJS) $(CLISVROBJS) $(CLIOBJS)
50 dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS) 52 dropbearkeyobjs=$(COMMONOBJS) $(KEYOBJS)
51 dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS) 53 dropbearconvertobjs=$(COMMONOBJS) $(CONVERTOBJS)
52 scpobjs=$(SCPOBJS) 54 scpobjs=$(SCPOBJS)
53 55
54 prefix=@prefix@ 56 prefix=@prefix@
55 exec_prefix=${prefix} 57 exec_prefix=${prefix}
56 bindir=${exec_prefix}/bin 58 bindir=${exec_prefix}/bin
57 sbindir=${exec_prefix}/sbin 59 sbindir=${exec_prefix}/sbin
58 60
59 CC=@CC@ 61 CC=@CC@
60 LD=@CC@ 62 LD=@LD@
61 AR=@AR@ 63 AR=@AR@
62 RANLIB=@RANLIB@ 64 RANLIB=@RANLIB@
63 STRIP=@STRIP@ 65 STRIP=@STRIP@
64 INSTALL=@INSTALL@ 66 INSTALL=@INSTALL@
65 CFLAGS=@CFLAGS@ 67 CFLAGS=@CFLAGS@
67 LDFLAGS=@LDFLAGS@ 69 LDFLAGS=@LDFLAGS@
68 70
69 EXEEXT=@EXEEXT@ 71 EXEEXT=@EXEEXT@
70 72
71 # whether we're building client, server, or both for the common objects. 73 # whether we're building client, server, or both for the common objects.
74 # evilness so we detect 'dropbear' by itself as a word
72 space:= $(empty) $(empty) 75 space:= $(empty) $(empty)
73 CLISVRFLAGS= 76 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdropbearZ, Z$(prog)Z))))
74 # evilness so we detect 'dropbear' by itself as a word 77 CFLAGS+= -DDROPBEAR_SERVER
75 ifneq (,$(findstring $(space)dropbear$(space), $(space)$(PROGRAMS)$(space)))
76 CLISVRFLAGS+= -DDROPBEAR_SERVER
77 endif 78 endif
78 ifneq (,$(findstring $(space)dbclient$(space), $(space)$(PROGRAMS)$(space))) 79 ifneq (,$(strip $(foreach prog, $(PROGRAMS), $(findstring ZdbclientZ, Z$(prog)Z))))
79 CLISVRFLAGS+= -DDROPBEAR_CLIENT 80 CFLAGS+= -DDROPBEAR_CLIENT
80 endif 81 endif
81 82
82 CFLAGS+=$(CLISVRFLAGS)
83 83
84 # these are exported so that libtomcrypt's makefile will use them 84 # these are exported so that libtomcrypt's makefile will use them
85 export CC 85 export CC
86 export CFLAGS 86 export CFLAGS
87 export RANLIB AR STRIP 87 export RANLIB AR STRIP
106 106
107 #%: $(HEADERS) 107 #%: $(HEADERS)
108 #%: $(HEADERS) Makefile 108 #%: $(HEADERS) Makefile
109 # TODO 109 # TODO
110 110
111 all: $(TARGETS)
112
113 test:
114 @echo Z$(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))Z
111 115
112 strip: $(TARGETS) 116 strip: $(TARGETS)
113 $(STRIP) $(foreach prog, $(TARGETS), $(SPREFIX)$(prog)$(EXEEXT)) 117 $(STRIP) $(addsuffix $(EXEEXT), $(addprefix $(SPREFIX), $(TARGETS)))
114 118
115 119 install: $(addprefix install, $(TARGETS))
116 install: $(foreach prog, $(TARGETS), install$prog)
117 120
118 # dropbear should go in sbin, so it needs a seperate rule 121 # dropbear should go in sbin, so it needs a seperate rule
119 installdropbear: dropbear 122 installdropbear: dropbear
120 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir) 123 $(INSTALL) -d -m 755 $(DESTDIR)$(sbindir)
121 $(INSTALL) -m 755 $(SPREFIX)dropbear$(EXEEXT) $(DESTDIR)$(sbindir) 124 $(INSTALL) -m 755 $(SPREFIX)dropbear$(EXEEXT) $(DESTDIR)$(sbindir)
126 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) 129 $(INSTALL) -d -m 755 $(DESTDIR)$(bindir)
127 $(INSTALL) -m 755 $(SPREFIX)$*$(EXEEXT) $(DESTDIR)$(bindir) 130 $(INSTALL) -m 755 $(SPREFIX)$*$(EXEEXT) $(DESTDIR)$(bindir)
128 -chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT) 131 -chown root $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
129 -chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT) 132 -chgrp 0 $(DESTDIR)$(sbindir)/$(SPREFIX)$*$(EXEEXT)
130 ifeq ($(MULTI), 1) 133 ifeq ($(MULTI), 1)
134 @echo
131 @echo "You must manually create links for $*" 135 @echo "You must manually create links for $*"
132 endif 136 endif
133 137
134 138
135 139
136 # The actual binaries 140 # for some reason the rule further down doesn't like $($@objs) as a prereq.
137 dropbear: $(dropbearobjs) 141 dropbear: $(dropbearobjs)
142 dbclient: $(dbclientobjs)
143 dropbearkey: $(dropbearkeyobjs)
144 dropbearconvert: $(dropbearconvertobjs)
138 145
139 dropbear dbclient dropbearkey dropbearconvert: $($($@objs)) $(HEADERS) \ 146 dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM)
140 $(LTC) $(LTM)
141 @echo $(CLISVRFLAGS)
142 $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS) 147 $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $($@objs) $(LIBS)
143
144 148
145 # scp doesn't use the libs so is special. 149 # scp doesn't use the libs so is special.
146 scp: $(SCPOBJS) $(HEADERS) 150 scp: $(SCPOBJS) $(HEADERS)
147 $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS) 151 $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(SCPOBJS)
148 152
149 153
150 MULTIOBJS=dbmulti.o 154 # multi-binary compilation.
155 MULTIOBJS=
151 ifeq ($(MULTI),1) 156 ifeq ($(MULTI),1)
152 deftarget=multi 157 MULTIOBJS=dbmulti.o $(sort $(foreach prog, $(PROGRAMS), $($(prog)objs)))
153 MULTIOBJS=$(foreach prog, $(PROGRAMS), $($(prog)objs)) 158 CFLAGS+=$(addprefix -DDBMULTI_, $(PROGRAMS)) -DDROPBEAR_MULTI
154 endif 159 endif
160
161 testfoo:
162 echo $(MULTIOBJS)
155 163
156 dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM) 164 dropbearmulti: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM)
157 $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS) 165 $(LD) $(LDFLAGS) -o $(SPREFIX)$@$(EXEEXT) $(MULTIOBJS) $(LIBS)
166 @echo
158 @echo "You should now create symlinks to the programs you have included" 167 @echo "You should now create symlinks to the programs you have included"
159 @echo "ie 'ln -s dropbearmulti dropbear'" 168 @echo "ie 'ln -s dropbearmulti dropbear'"
160 169
161 $(LTC): $(HEADERS) 170 $(LTC): $(HEADERS)
162 cd libtomcrypt && $(MAKE) clean && $(MAKE) 171 cd libtomcrypt && $(MAKE) clean && $(MAKE)