File: Makefile

package info (click to toggle)
socks4-server 4.3.beta2-20
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,512 kB
  • ctags: 1,778
  • sloc: ansic: 19,305; makefile: 399; sh: 52
file content (424 lines) | stat: -rw-r--r-- 13,348 bytes parent folder | download | duplicates (2)
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
# Be sure to check the file include/socks.h also and make
# modifications as necessary.

SHELL=/bin/sh

# If you do not want to support bind() function across the firewall,
# uncomment the next line.
#NO_RBIND=-DNO_RBIND
#
# Among common applications, only ftp uses bind() and even it
# can often work without bind() by using the PASV mode.
# The program rftp in this package always uses PASV mode first
# and only tries bind() after PASV mode fails.

#SOCKS=-Dconnect=Rconnect -Dselect=Rselect -Dgethostbyname=Rgethostbyname
# or
SOCKS=-Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dlisten=Rlisten -Daccept=Raccept -Dbind=Rbind -Dselect=Rselect -Dgethostbyname=Rgethostbyname
#
# If NO_RBIND is defined, you MUST use the first definition for SOCKS!
# For AIX: accept() and getsockname() are called naccept() and ngetsockname(),
# respectively. So you have to modify the SOCKS line above to accommodate
# these, i.e., use -Dngetsockname=Rgetsocknam and -Dnaccept=Raccept.

# If your system doesn't have PWD defined, define it here:
#PWD=/disk2/socks.4.3
pwd   := $(shell pwd)
PWD=${pwd}
# It should be this current directory.

# If your system has getcwd() but no getwd(), uncomment the next line:
#GETCWD=-DGETCWD

#If your system doesn't have waitpid(), uncomment the nextline:
#NO_WAITPID=-DNO_WAITPID

# Define FASCIST if you want ftp (rftp) to log names of all files transferred
#FASCIST=-DFASCIST

# Define FOR_PS if your system is not SYSV and you want to have the
# command 'ps' show some details of sockd's activity.
#FOR_PS=-DFOR_PS

# optimization flag for cc
OPTIMIZE=-g
#OPTIMIZE=-O
# Be careful with the OPTIMIZE flag. SunPro's SC2.0.1, for example, is
# knwon to produce incorrect code when -O is used.

#If your system does not have strdup() function, uncomment the next line:
#STRDUP=strdup.o

# Define NO_CLIENT_LOG if you don't want SOCKS clients to produce
# log entries of its activities.
#NO_CLIENT_LOG= -Dopenlog=socks_0openlog -Dsyslog=socks_0syslog -Dcloselog=socks_0closelog

# Define DNS_THROUGH_NIS if your SOCKS client hosts let their NIS
# servers do the DNS loopkup for them. You are in this category if
# your client hosts has no /etc/resolv.conf but can resolve all
# internal and external names.
#DNS_THROUGH_NIS=-DDNS_THROUGH_NIS

# If you get 'herror undefined', 'h_errno undefined', 'herror redefined'
# or 'h_errno redefined' error message,
# this is the macro to change. Define it or undefine it, whichever
# works. The reasons are too messy to explain.
#BIND_RESOLVER=-DBIND_RESOLVER

# Directory into which to install the man pages
MAN_DEST_DIR = $(DESTDIR)/usr/share/man

# Directory into which the SOCKS server should be installed
SERVER_BIN_DIR = $(DESTDIR)/usr/sbin

# Directory into the client programs should be installed
CLIENTS_BIN_DIR = $(DESTDIR)/usr/bin

# Directory into which the socks library (libsocks.a) should be installed
LIB_DEST_DIR = $(DESTDIR)/usr/lib

# SunOS 4.1.x should use
#CC=cc
#CC=gcc
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT $(DEBUG) $(NO_RBIND)
#RANLIB=ranlib
#OS=sun4.1
#INSTALL=install
#GETPASS=getpass.o
#RESOLV_LIB=-lresolv
# ... or 
#RESOLV_LIB=

# IRIX 4 should use
#CC=cc
#RESOLV_LIB=-lsun
#OTHER_CFLAGS=-cckr $(GETCWD) $(FASCIST) -DCOMPAT -DSYSTYPE_SVR4 $(NO_RBIND)
#RANLIB=/bin/true
#OS=irix4
#INSTALL=$(PWD)/bsdinstall
#GETPASS=getpass.o

# IRIX 5 should use
#CC=cc
#RESOLV_LIB=
#OTHER_CFLAGS=-cckr $(GETCWD) $(FASCIST) -DCOMPAT -DSVR3 -DNCARGS=`sysconf ARG_MAX` -D_BSD_SIGNALS $(NO_RBIND)
#RANLIB=/bin/true
#OS=irix5
#INSTALL=$(PWD)/bsdinstall
#GETPASS=getpass.o

# Ultrix 4.0 should use
#CC=cc
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) $(NO_RBIND)
#RANLIB=ranlib
#OS=ultrix4.0
#INSTALL=install
#GETPASS=getpass.o
#RESOLV_LIB=-lresolv
# Ultrix 4.3 should use the one below instead
#RESOLV_LIB=
# Ultrix 4.4 should use the one below instead
#RESOLV_LIB=-lresolv -l44bsd

# HP-UX should use
#CC=cc
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT $(NO_RBIND)
#RANLIB=/bin/true
#OS=hpux9
#INSTALL=install
#GETPASS=
#RESOLV_LIB=
# HPUX does not allow 'nobody' to be used as the user in /etc/inetd.conf,
# unless it has a gid between 0 and 60000, which it normally doe not. So
# you either have to use a different user in /etc/inetd.conf or change
# the gid of 'nobody'.

# RS/6000 AIX 3.2 should use
#CC=cc
#RESOLV_LIB=-lbsd
#OTHER_CFLAGS=-D_BSD -D_NONSTD_TYPES -D_NO_PROTO -DAIX $(GETCWD) $(FASCIST) -DCOMPAT $(NO_RBIND)
#RANLIB=ranlib
#OS=aix3.2
#INSTALL=$(PWD)/bsdinstall
#GETPASS=

# PS/2 AIX 1.2 should use
#CC=cc
#RESOLV_LIB=-lbsd
#OTHER_CFLAGS=-D_BSD -D_NONSTD_TYPES -D_NO_PROTO -DAIX $(GETCWD) $(FASCIST) -DCOMPAT -I/usr/local/include -DAIX_PS2 $(NO_RBIND)
#RANLIB=ranlib
#OS=aix_ps2
#INSTALL=install
#GETPASS=

# SOLARIS should use
#CC=cc
#RESOLV_LIB=-lresolv -lnsl -lsocket
#OTHER_CFLAGS=-DSOLARIS -Dindex=strchr -Drindex=strrchr -DUSE_DIRENT $(GETCWD) $(FASCIST) -DCOMPAT $(NO_RBIND)
#RANLIB=/bin/true
#OS=solaris2.2
#INSTALL=install
#GETPASS=getpass.o

# Interactive Systems Unix should use
#OTHER_CFLAGS = -DISC -DSVR3 -Dindex=strchr -Drindex=strrchr -D_XOPEN_SOURCE -DGETCWD $(FASCIST) -DCOMPAT $(NO_RBIND)
#CC=cc
#RANLIB=:
#OS=isc
#INSTALL=$(PWD)/bsdinstall
#GETPASS=
#RESOLV_LIB=-linet -lc_s

# netBSD should use
#OTHER_CFLAGS = $(GETCWD) $(FASCIST) $(NO_RBIND)
#CC=cc
#RANLIB=ranlib
#OS=netbsd0.9
#INSTALL=install
#GETPASS=
#RESOLV_LIB=

# FreeBSD should use:
#CC=cc
#OS=freebsd1.1
#RESOLV_LIB=
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) $(NO_RBIND)
#RANLIB=ranlib
#GETPASS=
#INSTALL=install

# LINUX should use
CC=gcc
RANLIB=ranlib
RESOLV_LIB=
# NOTE: Older versions of Linux may need to define the following variable,
#       as their <sys/socket.h> files do not define "struct linger".
#NEED_STRUCT_LINGER = -DNEED_STRUCT_LINGER
OTHER_CFLAGS= -DLINUX  $(GETCWD) $(FASCIST) $(NEED_STRUCT_LINGER) $(NO_RBIND)
OS=linux
INSTALL=install
GETPASS=getpass.o
# Additional notes for Linux:
# 1) There is a bug in getsockname() which returns address 127.0.0.1 when
#    the result should be 0.0.0.0. Because of this, the non multi-homed
#    version of sockd doesn't work. The multi-homed version works fine
#    and can be used even on a single-homed Linux box. Just set up the
#    /etc/sockd.route file to direct all traffic through the one and only
#    interface.
# 2) Linux doesn't define user 'nobody' in its distribution. To run sockd on
#    linux, you must either add 'nobody' (give it minimum privileges) or
#    run it under an existing userid (i.e., replace 'nobody' in the
#    /etc/inetd.conf entry by an existing userid).

# UnixWare should use
#CC=cc
#RESOLV_LIB=-lresolv -lnsl -lsocket
#OTHER_CFLAGS= -DSOLARIS -Dindex=strchr -Drindex=strrchr -DUSE_DIRENT $(GETCWD) $(FASCIST) -DCOMPAT $(NO_RBIND)
#RANLIB=/bin/true
#INSTALL=/usr/ucb/install
#OS=UnixWare
#GETPASS=getpass.o

# Alpha OSF should use:
#CC=cc
#RESOLV_LIB=-lresolv
#OS=alphaOSF
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT $(NO_RBIND)
#RANLIB=ranlib
#INSTALL=install
#GETPASS=

# SCO UNIX/ODT should use:
#CC=cc
#OS=sco
#RESOLV_LIB=-lsocket
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DSCO -DSVR3 -Dindex=strchr -Drindex=strrchr -DUSE_DIRENT $(NO_RBIND)
#RANLIB=/bin/true
#GETPASS=
#You MUST define PWD; see explanation earlier in this file.
# >>> Thomas Essebier <tom@stallion.oz.au>
#SERVER_BIN_DIR = /etc
# sco install does not work like 'other' installs.
# assuming all calls to install here are: install -m xxx file dir
# sco uses the convention: install -c dir -m xxx file
# create scoinstall in a directory in the normal path (eg. /usr/local/bin)
# its a 1 line script to munge the parameters to fit SCO's conventions
# -> install -c $4 $1 $2 $3
#INSTALL=scoinstall
# <<< Thomas Essebier <tom@stallion.oz.au>


# BSD/386 should use:
#CC=cc
#OS=bsdi
#RESOLV_LIB=
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) $(NO_RBIND)
#RANLIB=ranlib
#GETPASS=
# BSDI forgot to put appropriate lines in their /usr/include/netinet/in.h
# to prevent the code from being processed multiple times. This causes
# compiler to complain. You have to fix their oversight by adding
#	#ifndef _netinet_in_h
#	#define _netinet_in_h
# at the beginning of the file, and adding
#	#endif
# at the end of the file.


# NextStep 3.2, SOCKS server and library only
# (William Lewis, wiml@omnigroup.com)
#CC=cc
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT $(DEBUG) -Dstrdup=NXCopyStringBuffer $(NO_RBIND)
#RANLIB=ranlib
#GETPASS=getpass.o
#RESOLV_LIB=-lresolv
# ... or 
#RESOLV_LIB=

# DG/UX 5.4 should use
#CC=cc
#RESOLV_LIB=
#OTHER_CFLAGS=-DDGUX -DUSE_DIRENT $(GETCWD) $(FASCIST) -DCOMPAT $(NO_RBIND)
#RANLIB=/bin/true
#OS=dgux5.4
#INSTALL=$(PWD)/bsdinstall
#GETPASS=
  
# NewsOS 4.x should use
#CC=gcc
#OTHER_CFLAGS= $(GETCWD) $(FASCIST) -DCOMPAT $(DEBUG) $(NO_RBIND)
#RANLIB=ranlib
#OS=newsos4
#INSTALL=install
#GETPASS=getpass.o
#RESOLV_LIB=-lresolv -l44bsd
# !!! Remember to define NO_WAITPID !!!

# >>>---------------- Others:

# Define RESOLV_LIB if your system doesn't search resolver
# library automatically.
# Leave it undefined otherwise.
#RESOLV_LIB=-lresolv
# If your compiler or loader complains about _res_init being
# an undefined symbol, then you must define RESOLV_LIB.

#RANLIB=ranlib
# Systems (e.g., IRIX) that do not need (and thus don't have) ranlib should use
#RANLIB=/bin/true

# Comment out defintion of GETPASS if your system has problems
# compiling it, the version built into your system will then be used.
# The getpass() function in most Unix systems truncates passwords
# after 8 characters; the version provided here does not.
# This only affects ftp with non-anonymous login, and telnet.
# Ftp with anonymous login allows long passwords regardless
# of whether GETPASS is defined or not.
#GETPASS=getpass.o

# The 'install' command is assumed to be the BSD variety (using -m to
# set the file mode). If the default 'install' on your system doesn't
# do that, you have to either specify an alternative one in the line below
# (e.g., /usr/ucb/install) or modify the other Makefile.
#INSTALL= install

# Macro OS is used in making rtelnet. See the list near top of
# rtelnet/telnet/Makefile for available choices.

# Remember to include -Dindex=strchr -Drindex=strrchr in OTHER_CFLAGS if
# you don't have index() and rindex() (Sys-V camp)

# <<<----------------

# The Internet Whois server; used to be nic.ddn.mil.
WHOIS_SERVER= WHOIS_SERVER=-DWHOIS_SERVER\'=\"rs.internic.net\"\'

SOCKS_LIB_DEP=$(PWD)/lib/libsocks.a
SOCKS_LIB=-L$(PWD)/lib/ -lsocks
IDENT_LIB=-lident

#==============================================================================

all: LIB MKFC server clients

server: LIB
	(cd sockd; $(MAKE) CC="$(CC)" RESOLV_LIB="$(RESOLV_LIB)" \
		OPTIMIZE="$(OPTIMIZE)" RANLIB="$(RANLIB)" \
		SOCKS_LIB="$(SOCKS_LIB)" \
		SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \
		IDENT_LIB="$(IDENT_LIB)" \
		OTHER_CFLAGS="$(OTHER_CFLAGS) $(FOR_PS) $(NO_WAITPID) $(NO_RBIND)")

clients: RFINGER RFTP RTELNET RUNSOCKS

LIB:
	(cd lib; $(MAKE) CC="$(CC)" GETPASS="$(GETPASS)" \
		STRDUP="$(STRDUP)" OPTIMIZE="$(OPTIMIZE)" \
		OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(BIND_RESOLVER) $(NO_WAITPID) $(DNS_THROUGH_NIS) $(NO_RBIND)" \
		RANLIB="$(RANLIB)")

LIBIDENT:
	(cd libident; $(MAKE) CC="$(CC)" OTHER_CFLAGS="$(OTHER_CFLAGS)" \
		OPTIMIZE="$(OPTIMIZE)" RANLIB="$(RANLIB)")

# This also build rwhois
RFINGER: LIB
	(cd rfinger; $(MAKE) CC="$(CC)" $(WHOIS_SERVER) \
		OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \
		RESOLV_LIB="$(RESOLV_LIB)" SOCKS_LIB="$(SOCKS_LIB)" \
		SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \
		OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(NO_WAITPID) $(NO_RBIND)")

RTELNET: LIB
	(cd rtelnet; $(MAKE) CC="$(CC)" OS="$(OS)" SOCKS_LIB="$(SOCKS_LIB)" \
		SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \
		OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \
		RESOLV_LIB="$(RESOLV_LIB)" \
		OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(NO_WAITPID) $(NO_RBIND)")

RFTP: LIB
	(cd rftp; $(MAKE) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" \
		SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \
		OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \
		RESOLV_LIB="$(RESOLV_LIB)" \
		OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(BIND_RESOLVER) $(NO_WAITPID) $(NO_RBIND)")

RUNSOCKS: LIB
	(cd runsocks; $(MAKE) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" \
		SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \
		OPTIMIZE="$(OPTIMIZE)" SOCKS="$(SOCKS)" \
		RESOLV_LIB="$(RESOLV_LIB)" \
		OTHER_CFLAGS="$(OTHER_CFLAGS) $(NO_CLIENT_LOG) $(BIND_RESOLVER) $(NO_WAITPID) $(NO_RBIND)")

MKFC: LIB
	(cd mkfc; $(MAKE) CC="$(CC)" SOCKS_LIB="$(SOCKS_LIB)" \
		SOCKS_LIB_DEP="$(SOCKS_LIB_DEP)" \
		RESOLV_LIB="$(RESOLV_LIB)" \
		OPTIMIZE="$(OPTIMIZE)" OTHER_CFLAGS="$(OTHER_CFLAGS)" )

install.server: server
	(cd sockd; $(MAKE) INSTALL="$(INSTALL)" MAN_DEST_DIR="$(MAN_DEST_DIR)" \
		SERVER_BIN_DIR="$(SERVER_BIN_DIR)" install install.man)

install.clients: RFINGER RFTP RTELNET RUNSOCKS install.man
	for i in rfinger rftp rtelnet runsocks; do \
		(cd $$i ; $(MAKE) INSTALL="$(INSTALL)" \
			CLIENTS_BIN_DIR="$(CLIENTS_BIN_DIR)" \
			LIB_DEST_DIR="$(LIB_DEST_DIR)" \
			install); done
install.mkfc: MKFC
	(cd mkfc; $(MAKE) INSTALL="$(INSTALL)" \
		MKFC_DIR="$(SERVER_BIN_DIR)" install)

install.lib: LIB
	(cd lib; $(MAKE) INSTALL="$(INSTALL)" LIB_DEST_DIR="$(LIB_DEST_DIR)" install)

install.man:
	(cd doc; $(MAKE) INSTALL="$(INSTALL)" MAN_DEST_DIR="$(MAN_DEST_DIR)" \
		install)

clean:
	for i in lib libident sockd rfinger rftp rtelnet runsocks mkfc; do \
		( cd $$i ; $(MAKE) clean); done