-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
265 lines (207 loc) · 7.49 KB
/
Makefile
File metadata and controls
265 lines (207 loc) · 7.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#
# Makefile for Zebedee
#
ZBD_VERSION = 2.5.7
OS =
###
### Locations of tools, libraries and installation directories.
### You may well need to change these.
###
# Choose your C compiler
CC_$(OS) = gcc
CC_win32 = gcc
CC_linux = gcc -pthread
CC_linux64 = $(CC_linux) -m64
CC_solaris = gcc
CC_freebsd = gcc -pthread
CC_tru64 = cc
CC_irix = cc -n32 -woff 1110
CC_hpux = cc -Ae +DAportable
CC_macosx = cc
CC_bsdi = gcc -DINADDR_LOOPBACK=127
CC = $(CC_$(OS))
# Optimise/debug compilation
#OPTIM = -Wall -g
OPTIM = -Wall -O3
# Location of gmp include and library
#
# NOTE: These are no longer used unless you define USE_GMP_LIBRARY (which is
# undefined by default). Uncomment them as necessary.
# GMPINC = -I../gmp-2.0.2
# GMPLIB = ../gmp-2.0.2/libgmp.a
# Location of Blowfish include and library
# You can use the versions from OpenSSL if you have it installed, as follows:
# BFINC = -I/usr/include/openssl
# BFLIB = -lcrypto
BFINC = -I../blowfish-1.0.0a
BFLIB = ../blowfish-1.0.0a/libblowfish.a
# Location of zlib include and library
#ZINC = -I/usr/include
#ZLIB = -lz
ZINC = -I../zlib-1.2.5
ZLIB = ../zlib-1.2.5/libz.a
# Location of bzlib include and library
# Set these empty if you don't want bzib2 support
#BZINC = -I/usr/include
#BZLIB = -lbz2
BZINC = -I../bzip2-1.0.6
BZLIB = ../bzip2-1.0.6/libbz2.a
#
# Tools needed for Perl "POD"-format documentation conversion.
#
PERL_$(OS) = perl
PERL_win32 = c:/perl/bin/perl # Avoid Cygwin port
PERL = $(PERL_$(OS))
BAT_win32 = .bat
POD2HTML = $(PERL) -S pod2html$(BAT_$(OS))
POD2MAN = $(PERL) -S pod2man$(BAT_$(OS))
# Installation directories for the Linux/Solaris/*NIX World
ROOTDIR = /usr
BINDIR = $(ROOTDIR)/bin
ZBDDIR = $(ROOTDIR)/lib/zebedee
MANDIR = $(ROOTDIR)/man/man1
# This is a BSD-style install
INSTALL_$(OS) = install -c
INSTALL_linux = install -c
INSTALL_linux64 = $(INSTALL_linux)
INSTALL_solaris = /usr/ucb/install -c
INSTALL_freebsd = install -c
INSTALL_tru64 = installbsd -c
INSTALL_irix = install -c
INSTALL_hpux = install -c
INSTALL_macosx = install
INSTALL_bsdi = install -c
INSTALL = $(INSTALL_$(OS))
# InnoSetup compiler for Win32 (see http://www.jordanr.dhs.org/)
ISCOMP = "c:/Program Files/Inno Setup 4/compil32.exe"
###
### OS-specific definitions
###
### You should probably not have to change these. If you port Zebedee to
### a new platform add definitions of the form XXXX_osname
###
# Define one or more of the following ...
#
# Multi-threading:
# Use -DHAVE_PTHREADS if you have (and wish to use) POSIX threads
#
# If you have a system (such as FreeBSD) where fork and pthreads don't
# mix well define BUGGY_FORK_WITH_THREADS as well.
#
# Use of bzip2 compression:
# Use -DDONT_HAVE_BZIP2 if you do not have or do not want to support
# the use of bzip2 compression
#
# Lack of "inline" support in compiler (Irix, HPUX):
# Use -Dinline=
#
# Lack of <sys/select.h> (HPUX):
# Use -DDONT_HAVE_SELECT_H
#
# UDP source address spoofing:
# To spoof UDP source addresses (when using "transparent" mode) you will
# need "libnet" from http://www.packetfactory.net/Projects/Libnet. Then
# you should add -DUSE_UDP_SPOOFING (and -DLIBNET_LIL/BIG_ENDIAN as required
# by libnet). You must also add -lnet (or -pwrite) to the OSLIBS link
# libraries below. If you use this code please be aware of the security
# and practical implications of doing this kind of thing. Use it at your
# own risk!
#
# Thread stack size:
# The default is 32k but this can be overridded with the THREAD_STACK_SIZE
# definition. Currently this has only been found to be necessary on MacOSX.
#
# Windows FD_SETSIZE:
# Windows suffers from a fixed (at compile time) limit on the number of
# sockets that can be handled by a select() call. The default is set to
# 512, which should enable a server to handle about 250 simultaneous
# connections. If you need more then change the definition.
#
# IPv6 support:
# Use -DUSE_IPv6
#
DEFINES_win32 = -DFD_SETSIZE=512 -DUSE_IPv6
DEFINES_linux = -DHAVE_PTHREADS -DUSE_IPv6
DEFINES_linux64 = $(DEFINES_linux)
DEFINES_solaris = -D_REENTRANT -DHAVE_PTHREADS -DUSE_IPv6
DEFINES_freebsd = -DHAVE_PTHREADS -DBUGGY_FORK_WITH_THREADS -DUSE_IPv6
DEFINES_tru64 = -D_REENTRANT -DHAVE_PTHREADS
DEFINES_irix = -D_REENTRANT -DHAVE_PTHREADS -Dinline=
DEFINES_hpux = -D_REENTRANT -DHAVE_PTHREADS -DDONT_HAVE_SELECT_H -Dinline=
DEFINES_macosx = -D_REENTRANT -DHAVE_PTHREADS -DTHREAD_STACK_SIZE=49152 -DUSE_IPv6
DEFINES_bsdi =
DEFINES = $(DEFINES_$(OS))
# Suffix for executables
EXE_win32 = .exe # Win32
EXE = $(EXE_$(OS))
# Extra OS-specific libraries
OSLIBS_win32 = -lwsock32 -lwinmm
OSLIBS_linux = -lpthread
OSLIBS_linux64 = $(OSLIBS_linux)
OSLIBS_solaris = -lsocket -lnsl -lthread
OSLIBS_freebsd =
OSLIBS_tru64 = -lpthread
OSLIBS_irix = -lpthread
OSLIBS_hpux = -lpthread -lnsl
OSLIBS_macosx = -lpthread
OSLIBS_bsdi =
OSLIBS = $(OSLIBS_$(OS))
# Supplementary object files (Win32 ONLY)
GETOPTOBJ_win32 = getopt.o
GETOPTOBJ = $(GETOPTOBJ_$(OS))
SERVICEOBJ_win32 = service.o
SERVICEOBJ = $(SERVICEOBJ_$(OS))
####
#### You REALLY shouldn't have to modify anything beyond here ...
####
CFLAGS = $(OPTIM) $(DEFINES) -I. $(GMPINC) $(BFINC) $(ZINC) $(BZINC)
LIBS = $(GMPLIB) $(BFLIB) $(ZLIB) $(BZLIB) $(OSLIBS)
OBJS = zebedee.o sha_func.o huge.o $(GETOPTOBJ) $(SERVICEOBJ)
ZBDFILES = server.zbd vncviewer.zbd vncserver.zbd server.key server.id \
client1.key client2.key clients.id
TXTFILES = README.txt LICENCE.txt GPL2.txt CHANGES.txt NOTICE.txt \
zebedee.html ftpgw.tcl.html zebedee.ja_JP.html zebedee.iss
EXTRAFILES = $(ZBDFILES) $(TXTFILES)
all : precheck zebedee$(EXE) zebedee.1 zebedee.html ftpgw.tcl.1 ftpgw.tcl.html zebedee.ja_JP.html
precheck :
@ if test -z "$(OS)"; then echo "Use '$(MAKE) OS=xxx' where xxx is win32, linux, linux64, solaris, freebsd, tru64, irix, hpux, macosx or bsdi"; exit 1; fi
zebedee$(EXE) : $(OBJS)
$(CC) $(CFLAGS) -o zebedee$(EXE) $(OBJS) $(LIBS)
huge.o : huge.h
zebedee.1 : zebedee.pod
rm -f ./tmp/zebedee.pod
mkdir -p tmp
$(PERL) -pe 's/^\=head3/\=head2/;' zebedee.pod > ./tmp/zebedee.pod
$(POD2MAN) --release="Zebedee $(ZBD_VERSION)" --center=Zebedee ./tmp/zebedee.pod > zebedee.1
rm -f ./tmp/zebedee.pod
rmdir ./tmp
zebedee.html : zebedee.pod
$(POD2HTML) --title="Zebedee: A simple, secure IP tunnel" --noindex zebedee.pod > zebedee.tmp
$(PERL) fixhtml.pl < zebedee.tmp > zebedee.html
rm -f zebedee.tmp
zebedee.ja_JP.html :
( cd doc_jp; \
$(MAKE) PERL="$(PERL)" POD2HTML="$(POD2HTML)" POD2MAN="$(POD2MAN)" INSTALL="$(INSTALL)" ROOTDIR="$(ROOTDIR)" )
ftpgw.tcl.1 : ftpgw.tcl.pod
$(POD2MAN) --release="1.0" --center=ftpgw.tcl ftpgw.tcl.pod > ftpgw.tcl.1
ftpgw.tcl.html : ftpgw.tcl.pod
$(POD2HTML) --title="ftpgw.tcl: A simple FTP tunnelling gateway" --noindex ftpgw.tcl.pod > ftpgw.tcl.tmp
$(PERL) fixhtml.pl < ftpgw.tcl.tmp > ftpgw.tcl.html
rm -f ftpgw.tcl.tmp
install : precheck zebedee$(EXE) zebedee.1 ftpgw.tcl.1 $(ZBDFILES) $(TXTFILES)
-mkdir -p $(BINDIR) $(MANDIR) $(ZBDDIR)
$(INSTALL) zebedee$(EXE) $(BINDIR)
$(INSTALL) -m 0755 ftpgw.tcl $(BINDIR)
$(INSTALL) zebedee.1 $(MANDIR)
$(INSTALL) ftpgw.tcl.1 $(MANDIR)
$(INSTALL) $(ZBDFILES) $(ZBDDIR)
$(INSTALL) $(TXTFILES) $(ZBDDIR)
clean :
rm -f zebedee zebedee.exe *.o core *.1 *.html *.tmp *.bak doc_jp/*.tmp doc_jp/*.1 doc_jp/*.html
# This makes the Win32 setup.exe using InnoSetup. The perl command in
# this sequence "dosifies" the text files ... sigh ...
zbdsetup.exe : zebedee$(EXE) zebedee.html zebedee.ico vncloopback.reg \
$(ZBDFILES) $(TXTFILES)
$(PERL_win32) -ni.bak -e print $(ZBDFILES) $(TXTFILES) vncloopback.reg
$(ISCOMP) /cc zebedee.iss
mv -f Output/setup.exe zbdsetup.exe