1# @(#) Makefile 1.23 97/03/21 19:27:20
2# $FreeBSD$
3
4what:
5	@echo
6	@echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
7	@echo
8	@echo "	make sys-type"
9	@echo
10	@echo "If you are in a hurry you can try instead:"
11	@echo
12	@echo "	make REAL_DAEMON_DIR=/foo/bar sys-type"
13	@echo
14	@echo "And for a version with language extensions enabled:"
15	@echo
16	@echo "	make REAL_DAEMON_DIR=/foo/bar STYLE=-DPROCESS_OPTIONS sys-type"
17	@echo
18	@echo "This Makefile knows about the following sys-types:"
19	@echo
20	@echo "	generic (most bsd-ish systems with sys5 compatibility)"
21	@echo "	386bsd aix alpha apollo bsdos convex-ultranet dell-gcc dgux dgux543"
22	@echo "	dynix epix esix freebsd hpux irix4 irix5 irix6 isc iunix"
23	@echo "	linux machten mips(untested) ncrsvr4 netbsd next osf power_unix_211"
24	@echo "	ptx-2.x ptx-generic pyramid sco sco-nis sco-od2 sco-os5 sinix sunos4"
25	@echo "	sunos40 sunos5 solaris8 sysv4 tandem ultrix unicos7 unicos8 unixware1 unixware2"
26	@echo "	uts215 uxp"
27	@echo
28	@echo "If none of these match your environment, edit the system"
29	@echo "dependencies sections in the Makefile and do a 'make other'."
30	@echo
31
32#######################################################
33# Choice between easy and advanced installation recipe.
34# 
35# Advanced installation: vendor-provided daemons are left alone, and the
36# inetd configuration file is edited. In this case, the REAL_DAEMON_DIR
37# macro should reflect the actual directory with (most of) your
38# vendor-provided network daemons.  These names can be found in the
39# inetd.conf file. Usually, the telnet, ftp and finger daemons all live
40# in the same directory.
41# 
42# Uncomment the appropriate line if you are going to edit inetd.conf.
43#
44# Ultrix 4.x SunOS 4.x ConvexOS 10.x Dynix/ptx
45#REAL_DAEMON_DIR=/usr/etc
46#
47# SysV.4 Solaris 2.x OSF AIX
48#REAL_DAEMON_DIR=/usr/sbin
49#
50# BSD 4.4
51#REAL_DAEMON_DIR=/usr/libexec
52#
53# HP-UX SCO Unicos
54#REAL_DAEMON_DIR=/etc
55
56# Easy installation: vendor-provided network daemons are moved to "some
57# other" directory, and the tcpd wrapper fills in the "holes". For this
58# mode of operation, the REAL_DAEMON_DIR macro should be set to the "some
59# other" directory.  The "..." is here for historical reasons only; you
60# should probably use some other name. 
61# 
62# Uncomment the appropriate line if you are going to move your daemons.
63#
64# Ultrix 4.x SunOS 4.x ConvexOS 10.x Dynix/ptx
65#REAL_DAEMON_DIR=/usr/etc/...
66#
67# SysV.4 Solaris 2.x OSF AIX
68#REAL_DAEMON_DIR=/usr/sbin/...
69#
70# BSD 4.4
71#REAL_DAEMON_DIR=/usr/libexec/...
72#
73# HP-UX SCO Unicos
74#REAL_DAEMON_DIR=/etc/...
75
76# End of mandatory section
77##########################
78
79##########################################
80# Ready-to-use system-dependent templates.
81#
82# Ready-to-use templates are available for many systems (see the "echo"
83# commands at the start of this Makefile).  The templates take care of
84# all system dependencies: after editing the REAL_DAEMON_DIR definition
85# above, do a "make sunos4" (or whatever system type is appropriate).
86#
87# If your system is not listed (or something that comes close enough), you
88# have to edit the system dependencies section below and do a "make other".  
89#
90# Send templates for other UNIX versions to wietse@wzv.win.tue.nl.
91
92# This is good for many BSD+SYSV hybrids with NIS (formerly YP).
93generic aix osf alpha dynix:
94	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
95	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
96	NETGROUP=-DNETGROUP TLI= all
97
98# Ditto, with vsyslog
99sunos4:
100	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
101	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
102	NETGROUP=-DNETGROUP VSYSLOG= TLI= all
103
104# Generic with resolver library.
105generic-resolver:
106	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
107	LIBS=-lresolv RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
108	NETGROUP=-DNETGROUP TLI= all
109
110# The NeXT loader needs "-m" or it barfs on redefined library functions.
111next:
112	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
113	LIBS=-m RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
114	NETGROUP=-DNETGROUP TLI= all
115
116# SunOS for the 386 was frozen at release 4.0.x.
117sunos40:
118	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
119	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ="setenv.o strcasecmp.o" \
120	NETGROUP=-DNETGROUP VSYSLOG= TLI= all
121
122# Ultrix is like aix, next, etc., but has miscd and setenv().
123ultrix:
124	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
125	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= \
126	NETGROUP=-DNETGROUP TLI= all miscd
127
128# This works on EP/IX 1.4.3 and will likely work on Mips (reggers@julian.uwo.ca)
129epix:
130	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
131	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
132	NETGROUP=-DNETGROUP TLI= SYSTYPE="-systype bsd43" all
133
134# Freebsd and linux by default have no NIS.
135386bsd bsdos:
136	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
137	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
138	EXTRA_CFLAGS=-DSYS_ERRLIST_DEFINED VSYSLOG= all
139
140freebsd:
141	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
142	RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP=-DNETGROUP TLI= \
143	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DINET6 -DUSE_GETIPNODEBY" \
144	VSYSLOG= all
145
146netbsd:
147	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
148	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
149	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DINET6 \
150	-Dss_family=__ss_family -Dss_len=__ss_len" VSYSLOG= all
151
152linux:
153	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
154	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o NETGROUP= TLI= \
155	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER -DINET6=1 \
156	-Dss_family=__ss_family -Dss_len=__ss_len" all
157
158linux-old:
159	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
160	LIBS="/usr/inet6/lib/libinet6.a -lresolv" \
161	RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o NETGROUP= TLI= \
162	EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER -DINET6=1 -Dss_family=sin6_family -Dsockaddr_storage=sockaddr_in6 -I/usr/inet6/include" all
163
164# This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
165hpux hpux8 hpux9 hpux10:
166	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
167	LIBS= RANLIB=echo ARFLAGS=rv AUX_OBJ=setenv.o \
168	NETGROUP=-DNETGROUP TLI= all
169
170# ConvexOS-10.x with UltraNet support (ukkonen@csc.fi).
171convex-ultranet:
172	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
173	LIBS=-lulsock RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
174	NETGROUP=-DNETGROUP TLI= all
175
176# Generic support for the Dynix/PTX version of TLI.
177ptx-generic:
178	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
179	LIBS="-lsocket -linet -lnsl" RANLIB=echo ARFLAGS=rv \
180	AUX_OBJ="setenv.o strcasecmp.o ptx.o" NETGROUP= TLI=-DPTX all
181
182# With UDP support optimized for PTX 2.x (timw@sequent.com).
183ptx-2.x:
184	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
185	LIBS="-lsocket -linet -lnsl" RANLIB=echo ARFLAGS=rv \
186	AUX_OBJ="setenv.o strcasecmp.o tli-sequent.o" NETGROUP= \
187	TLI=-DTLI_SEQUENT all
188
189# IRIX 4.0.x has a special ar(1) flag.
190irix4:
191	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
192	LIBS="-lc -lsun" RANLIB=echo ARFLAGS=rvs AUX_OBJ=setenv.o \
193	NETGROUP=-DNETGROUP TLI= all
194
195# IRIX 5.2 is SYSV4 with several broken things (such as -lsocket -lnsl).
196irix5:
197	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
198	LIBS=-lsun RANLIB=echo ARFLAGS=rv VSYSLOG= \
199	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI= all
200
201# IRIX 6.2 (tucker@math.unc.edu). Must find a better value than 200000.
202irix6:
203	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
204	LIBS= RANLIB=echo ARFLAGS=rv VSYSLOG= \
205	NETGROUP=-DNETGROUP EXTRA_CFLAGS="-DBSD=200000" TLI= all
206
207# SunOS 5.x is another SYSV4 variant.
208sunos5:
209	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
210	LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv VSYSLOG= \
211	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI \
212	BUGS="$(BUGS) -DSOLARIS_24_GETHOSTBYNAME_BUG" all
213
214# SunOS 5.8 is another SYSV4 variant, but has IPv6 support
215solaris8:
216	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
217	LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv VSYSLOG= \
218	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI \
219	EXTRA_CFLAGS="-DINET6 -DUSE_GETIPNODEBY -DNO_CLONE_DEVICE \
220	-DINT32_T" all
221
222# Generic SYSV40
223esix sysv4:
224	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
225	LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv \
226	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI all
227
228# DG/UX 5.4.1 and 5.4.2 have an unusual inet_addr() interface.
229dgux:
230	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
231	LIBS=-lnsl RANLIB=echo ARFLAGS=rv \
232	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI \
233	BUGS="$(BUGS) -DINET_ADDR_BUG" all
234
235dgux543:
236	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
237	LIBS=-lnsl RANLIB=echo ARFLAGS=rv \
238	NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI all
239
240# NCR UNIX 02.02.01 and 02.03.00 (Alex Chircop, msu@unimt.mt)
241ncrsvr4:
242	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
243	LIBS="-lresolv -lnsl -lsocket" RANLIB=echo ARFLAGS=rv \
244	AUX_OBJ="setenv.o strcasecmp.o" NETGROUP= TLI=-DTLI \
245	EXTRA_CFLAGS="" FROM_OBJ=ncr.o all
246
247# Tandem SYSV4 (eqawas@hedgehog.ac.cowan.edu.au)
248tandem:
249	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
250	LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv \
251	NETGROUP= AUX_OBJ="setenv.o strcasecmp.o" TLI=-DTLI all
252
253# Amdahl UTS 2.1.5 (Richard.Richmond@bridge.bst.bls.com)
254uts215:
255	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
256	LIBS="-lsocket" RANLIB=echo \
257	ARFLAGS=rv AUX_OBJ=setenv.o NETGROUP=-DNO_NETGROUP TLI= all
258
259# UXP/DS System V.4 clone (vic@uida0.uida.es).
260uxp:
261	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
262	LIBS="-L/usr/ucblib -lsocket -lnsl -lucb" \
263	RANLIB=echo ARFLAGS=rv NETGROUP=-DNETGROUP \
264	AUX_OBJ=setenv.o TLI="-DTLI -DDRS_XTI" all
265
266# DELL System V.4 Issue 2.2 using gcc (kim@tac.nyc.ny.us, jurban@norden1.com)
267dell-gcc:
268	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
269	LIBS="-lsocket -lnsl" RANLIB=ranlib ARFLAGS=rv CC=gcc \
270	AUX_OBJ="setenv.o strcasecmp.o" TLI=-DTLI all
271
272# SCO 3.2v4.1 no frills (jedwards@sol1.solinet.net).
273sco:
274	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
275	LIBS="-lsocket -lnsl_s" RANLIB=echo ARFLAGS=rv \
276	NETGROUP= AUX_OBJ=setenv.o TLI= all
277
278# SCO OpenDesktop 2.0, release 3.2 (peter@midnight.com). Please simplify.
279sco-od2:
280	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
281	LIBS="-lrpcsvc -lrpc -lyp -lrpc -lrpcsvc -lsocket" \
282	RANLIB=echo ARFLAGS=rv AUX_OBJ=setenv.o \
283	NETGROUP=-DNETGROUP TLI= all
284
285# SCO 3.2v4.2 with TCP/IP 1.2.1 (Eduard.Vopicka@vse.cz). Please simplify.
286sco-nis:
287	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
288	LIBS="-lyp -lrpc -lsocket -lyp -lc_s -lc" \
289	RANLIB=echo ARFLAGS=rv AUX_OBJ=setenv.o \
290	NETGROUP=-DNETGROUP TLI= EXTRA_CFLAGS="-nointl -DNO_NETGRENT" all
291
292# SCO 3.2v5.0.0 OpenServer 5 (bob@odt.handy.com, bill@razorlogic.com)
293sco-os5:
294	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
295	LIBS="-lrpcsvc -lsocket" RANLIB=echo ARFLAGS=rv VSYSLOG= \
296	AUX_OBJ=setenv.o NETGROUP=-DNETGROUP TLI= all
297
298# sinix 5.42 setjmp workaround (szrzs023@ub3.ub.uni-kiel.de)
299sinix:
300	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
301	LIBS="-lsocket -lnsl -L/usr/ccs/lib -lc -L/usr/ucblib -lucb" \
302	RANLIB=echo ARFLAGS=rv AUX_OBJ=setenv.o TLI=-DTLI all
303
304# Domain SR10.4. Build under bsd, run under either sysv3 or bsd43.
305apollo:
306	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
307	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
308	NETGROUP=-DNETGROUP TLI= SYSTYPE="-A run,any -A sys,any" all
309
310# Pyramid OSx 5.1, using the BSD universe.
311pyramid:
312	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
313	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ="environ.o vfprintf.o" \
314	STRINGS="-Dstrchr=index -Dstrrchr=rindex -Dmemcmp=bcmp -Dno_memcpy" \
315	NETGROUP="-DNETGROUP -DUSE_GETDOMAIN" TLI= all
316
317# Untested.
318mips:
319	@echo "Warning: some definitions may be wrong."
320	make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
321	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
322	NETGROUP=-DNETGROUP TLI= SYSTYPE="-sysname bsd43" all
323
324# Cray (tested with UNICOS 7.0.4).
325unicos7:
326	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
327	LIBS=-lnet RANLIB=echo ARFLAGS=rv \
328	EXTRA_CFLAGS=-DINADDR_NONE="\"((unsigned long) -1)\"" \
329	AUX_OBJ="setenv.o strcasecmp.o" NETGROUP= TLI= all
330
331# Unicos 8.x, Cray-YMP (Bruce Kelly).
332unicos8:
333	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
334	LIBS= RANLIB=echo AR=bld ARFLAGS=rv \
335	AUX_OBJ= NETGROUP= TLI= all
336
337# Power_UNIX 2.1.1 (amantel@lerc.nasa.gov)
338power_unix_211:
339	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
340	LIBS="-lnsl -lsocket -lgen -lresolv" RANLIB=echo ARFLAGS=rv \
341	NETGROUP= AUX_OBJ=setenv.o TLI=-DTLI BUGS="$(BUGS)" all
342
343# ISC (fc@all.net)
344isc:
345	make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
346	LIBS="-linet -lnsl_s -ldbm" RANLIB=echo ARFLAGS=rv \
347	AUX_OBJ="setenv.o strcasecmp.o" EXTRA_CFLAGS="-DENOTCONN=ENAVAIL" \
348	NETGROUP= TLI= all
349
350# Interactive UNIX R3.2 version 4.0 (Bobby D. Wright).
351iunix:
352	make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
353	LIBS="-linet -lnsl_s -ldbm" RANLIB=echo ARFLAGS=rv \
354	AUX_OBJ=environ.o strcasecmp.o NETGROUP= TLI= all
355
356# RTU 6.0 on a Masscomp 5400 (ben@piglet.cr.usgs.gov). When using the
357# advanced installation, increment argv before actually looking at it.
358rtu:
359	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
360	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
361	NETGROUP= TLI= all
362
363# Unixware sans NIS (mc@telebase.com). Compiler dislikes strcasecmp.c.
364unixware1:
365	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
366	LIBS="-lsocket -lnsl -lc -L/usr/ucblib -lucb" RANLIB=echo ARFLAGS=rv \
367	NETGROUP=$(NETGROUP) AUX_OBJ=environ.o TLI=-DTLI all
368
369unixware2:
370	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
371	LIBS="-lsocket -lnsl -lgen -lc -L/usr/ucblib -lucb" RANLIB=echo \
372	ARFLAGS=rv NETGROUP=$(NETGROUP) AUX_OBJ=environ.o TLI=-DTLI all
373
374u6000:
375	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
376	LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv \
377	NETGROUP=-DNETGROUP AUX_OBJ="setenv.o strcasecmp.o" TLI=-DTLI all
378
379# MachTen
380machten:
381	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
382	LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
383	NETGROUP= TLI= all
384
385###############################################################
386# System dependencies: TLI (transport-level interface) support.
387# 
388# Uncomment the following macro if your system has System V.4-style TLI
389# support (/usr/include/sys/timod.h, /etc/netconfig, and the netdir(3)
390# routines).
391#
392#TLI	= -DTLI
393
394###############################################################################
395# System dependencies: differences between ranlib(1) and ar(1) implementations.
396#
397# Some C compilers (Ultrix 4.x) insist that ranlib(1) be run on an object
398# library; some don't care as long as the modules are in the right order;
399# some systems don't even have a ranlib(1) command. Make your choice.
400
401RANLIB	= ranlib	# have ranlib (BSD-ish UNIX)
402#RANLIB	= echo		# no ranlib (SYSV-ish UNIX)
403
404ARFLAGS	= rv		# most systems
405#ARFLAGS= rvs		# IRIX 4.0.x
406
407AR	= ar
408#AR	= bld		# Unicos 8.x
409
410#############################################################################
411# System dependencies: routines that are not present in the system libraries.
412# 
413# If your system library does not have set/putenv() or strcasecmp(), use
414# the ones provided with this source distribution. The environ.c module
415# implements setenv(), getenv(), and putenv().
416
417#AUX_OBJ= setenv.o
418#AUX_OBJ= environ.o
419#AUX_OBJ= environ.o strcasecmp.o
420
421# Uncomment the following if your C library does not provide the
422# strchr/strrchr/memcmp routines, but comes with index/rindex/bcmp.
423#
424#STRINGS= -Dstrchr=index -Dstrrchr=rindex -Dmemcmp=bcmp -Dno_memcpy
425
426#################################################################
427# System dependencies: selection of non-default object libraries.
428#
429# Most System V implementations require that you explicitly specify the
430# networking libraries. There is no general consensus, though.
431#
432#LIBS	= -lsocket -lnsl		# SysV.4 Solaris 2.x
433#LIBS	= -lsun				# IRIX
434#LIBS	= -lsocket -linet -lnsl -lnfs	# PTX
435#LIBS	= -linet -lnsl_s -ldbm		# ISC
436#LIBS	= -lnet				# Unicos 7
437#LIBS	= -linet -lsyslog -ldbm
438#LIBS	= -lsyslog -lsocket -lnsl
439
440######################################################
441# System dependencies: system-specific compiler flags.
442#
443# Apollo Domain/OS offers both bsd and sys5 environments, sometimes
444# on the same machine.  If your Apollo is primarily sys5.3 and also
445# has bsd4.3, uncomment the following to build under bsd and run under
446# either environment.
447#
448#SYSTYPE= -A run,any -A sys,any
449
450# For MIPS RISC/os 4_52.p3, uncomment the following definition.
451#
452#SYSTYPE= -sysname bsd43
453
454##################################################
455# System dependencies: working around system bugs.
456#
457# -DGETPEERNAME_BUG works around a getpeername(2) bug in some versions of
458# Apollo or SYSV.4 UNIX:  the wrapper would report that all UDP requests
459# come from address 0.0.0.0. The workaround does no harm on other systems.
460#
461# -DBROKEN_FGETS works around an fgets(3) bug in some System V versions
462# (IRIX):  fgets() gives up too fast when reading from a network socket.
463# The workaround does no harm on other systems.
464#
465# Some UNIX systems (IRIX) make the error of calling the strtok() library
466# routine from other library routines such as, e.g., gethostbyname/addr().
467# The result is that hosts can slip through the wrapper allow/deny filters.
468# Compile with -DLIBC_CALLS_STRTOK to avoid the vendor's strtok() routine.
469# The workaround does no harm on other systems.
470#
471# DG/UX 5.4.1 comes with an inet_ntoa() function that returns a structure
472# instead of a long integer. Compile with -DINET_ADDR_BUG to work around
473# this mutant behavour. Fixed in 5.4R3.
474#
475# Solaris 2.4 gethostbyname(), in DNS through NIS mode, puts only one
476# address in the host address list; all other addresses are treated as
477# host name aliases. Compile with -DSOLARIS_24_GETHOSTBYNAME_BUG to work
478# around this. The workaround does no harm on other Solaris versions.
479
480#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DLIBC_CALLS_STRTOK
481#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DINET_ADDR_BUG
482#BUGS = -DGETPEERNAME_BUG -DBROKEN_FGETS -DSOLARIS_24_GETHOSTBYNAME_BUG
483
484##########################################################################
485# System dependencies: whether or not your system has NIS (or YP) support.
486#
487# If your system supports NIS or YP-style netgroups, enable the following
488# macro definition. Netgroups are used only for host access control.
489#
490#NETGROUP= -DNETGROUP
491
492###############################################################
493# System dependencies: whether or not your system has vsyslog()
494#
495# If your system supports vsyslog(), comment out the following definition.
496# If in doubt leave it in, it won't harm.
497
498#VSYSLOG	= -Dvsyslog=myvsyslog
499
500# End of the system dependencies.
501#################################
502
503##############################
504# Start of the optional stuff.
505
506###########################################
507# Optional: Turning on language extensions
508#
509# Instead of the default access control language that is documented in
510# the hosts_access.5 document, the wrappers can be configured to
511# implement an extensible language documented in the hosts_options.5
512# document.  This language is implemented by the "options.c" source
513# module, which also gives hints on how to add your own extensions.
514# Uncomment the next definition to turn on the language extensions
515# (examples: allow, deny, banners, twist and spawn).
516# 
517#STYLE	= -DPROCESS_OPTIONS	# Enable language extensions.
518
519################################################################
520# Optional: Changing the default disposition of logfile records
521#
522# By default, logfile entries are written to the same file as used for
523# sendmail transaction logs. See your /etc/syslog.conf file for actual
524# path names of logfiles. The tutorial section in the README file
525# gives a brief introduction to the syslog daemon.
526# 
527# Change the FACILITY definition below if you disagree with the default
528# disposition. Some syslog versions (including Ultrix 4.x) do not provide
529# this flexibility.
530# 
531# If nothing shows up on your system, it may be that the syslog records
532# are sent to a dedicated loghost. It may also be that no syslog daemon
533# is running at all. The README file gives pointers to surrogate syslog
534# implementations for systems that have no syslog library routines or
535# no syslog daemons. When changing the syslog.conf file, remember that
536# there must be TABs between fields.
537#
538# The LOG_XXX names below are taken from the /usr/include/syslog.h file.
539
540FACILITY= LOG_MAIL	# LOG_MAIL is what most sendmail daemons use
541
542# The syslog priority at which successful connections are logged.
543
544SEVERITY= LOG_INFO	# LOG_INFO is normally not logged to the console
545
546###########################
547# Optional: Reduce DNS load
548#
549# When looking up the address for a host.domain name, the typical DNS
550# code will first append substrings of your own domain, so it tries
551# host.domain.your.own.domain, then host.domain.own.domain, and then
552# host.domain. The APPEND_DOT feature stops this waste of cycles. It is
553# off by default because it causes problems on sites that don't use DNS
554# and with Solaris < 2.4. APPEND_DOT will not work with hostnames taken
555# from /etc/hosts or from NIS maps. It does work with DNS through NIS.
556#
557# DOT= -DAPPEND_DOT
558
559##################################################
560# Optional: Always attempt remote username lookups
561#
562# By default, the wrappers look up the remote username only when the
563# access control rules require them to do so.
564#
565# Username lookups require that the remote host runs a daemon that
566# supports an RFC 931 like protocol.  Remote user name lookups are not
567# possible for UDP-based connections, and can cause noticeable delays
568# with connections from non-UNIX PCs.  On some systems, remote username
569# lookups can trigger a kernel bug, causing loss of service. The README
570# file describes how to find out if your UNIX kernel has that problem.
571# 
572# Uncomment the following definition if the wrappers should always
573# attempt to get the remote user name. If this is not enabled you can
574# still do selective username lookups as documented in the hosts_access.5
575# and hosts_options.5 manual pages (`nroff -man' format).
576#
577#AUTH	= -DALWAYS_RFC931
578#
579# The default username lookup timeout is 10 seconds. This may not be long
580# enough for slow hosts or networks, but is enough to irritate PC users.
581
582RFC931_TIMEOUT = 10
583
584######################################################
585# Optional: Changing the default file protection mask
586#
587# On many systems, network daemons and other system processes are started
588# with a zero umask value, so that world-writable files may be produced.
589# It is a good idea to edit your /etc/rc* files so that they begin with
590# an explicit umask setting.  On our site we use `umask 022' because it
591# does not break anything yet gives adequate protection against tampering.
592# 
593# The following macro specifies the default umask for processes run under
594# control of the daemon wrappers. Comment it out only if you are certain
595# that inetd and its children are started with a safe umask value.
596
597UMASK	= -DDAEMON_UMASK=022
598
599#######################################
600# Optional: Turning off access control
601#
602# By default, host access control is enabled.  To disable host access
603# control, comment out the following definition.  Host access control
604# can also be turned off at runtime by providing no or empty access
605# control tables.
606
607ACCESS	= -DHOSTS_ACCESS
608
609########################################################
610# Optional: Changing the access control table pathnames
611#
612# The HOSTS_ALLOW and HOSTS_DENY macros define where the programs will
613# look for access control information. Watch out for the quotes and
614# backslashes when you make changes.
615
616TABLES	= -DHOSTS_DENY=\"/etc/hosts.deny\" -DHOSTS_ALLOW=\"/etc/hosts.allow\"
617
618####################################################
619# Optional: dealing with host name/address conflicts
620#
621# By default, the software tries to protect against hosts that claim to
622# have someone elses host name. This is relevant for network services
623# whose authentication depends on host names, such as rsh and rlogin.
624#
625# With paranoid mode on, connections will be rejected when the host name
626# does not match the host address. Connections will also be rejected when
627# the host name is available but cannot be verified.
628#
629# Comment out the following definition if you want more control over such
630# requests. When paranoid mode is off and a host name double check fails,
631# the client can be matched with the PARANOID access control pattern.
632#
633# Paranoid mode implies hostname lookup. In order to disable hostname
634# lookups altogether, see the next section.
635
636PARANOID= -DPARANOID
637
638########################################
639# Optional: turning off hostname lookups
640#
641# By default, the software always attempts to look up the client
642# hostname.  With selective hostname lookups, the client hostname
643# lookup is postponed until the name is required by an access control
644# rule or by a %letter expansion.
645# 
646# In order to perform selective hostname lookups, disable paranoid
647# mode (see previous section) and comment out the following definition.
648
649HOSTNAME= -DALWAYS_HOSTNAME
650
651#############################################
652# Optional: Turning on host ADDRESS checking
653#
654# Optionally, the software tries to protect against hosts that pretend to
655# have someone elses host address. This is relevant for network services
656# whose authentication depends on host names, such as rsh and rlogin,
657# because the network address is used to look up the remote host name.
658# 
659# The protection is to refuse TCP connections with IP source routing
660# options.
661#
662# This feature cannot be used with SunOS 4.x because of a kernel bug in
663# the implementation of the getsockopt() system call. Kernel panics have
664# been observed for SunOS 4.1.[1-3]. Symptoms are "BAD TRAP" and "Data
665# fault" while executing the tcp_ctloutput() kernel function.
666#
667# Reportedly, Sun patch 100804-03 or 101790 fixes this for SunOS 4.1.x.
668#
669# Uncomment the following macro definition if your getsockopt() is OK.
670#
671# -DKILL_IP_OPTIONS is not needed on modern UNIX systems that can stop
672# source-routed traffic in the kernel. Examples: 4.4BSD derivatives,
673# Solaris 2.x, and Linux. See your system documentation for details.
674#
675# KILL_OPT= -DKILL_IP_OPTIONS
676
677## End configuration options
678############################
679
680# Protection against weird shells or weird make programs.
681
682SHELL	= /bin/sh
683.c.o:;	$(CC) $(CFLAGS) -c $*.c
684
685CFLAGS	= -O -DFACILITY=$(FACILITY) $(ACCESS) $(PARANOID) $(NETGROUP) \
686	$(BUGS) $(SYSTYPE) $(AUTH) $(UMASK) \
687	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
688	-DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
689	$(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS) $(DOT) \
690	$(VSYSLOG) $(HOSTNAME)
691
692LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o eval.o \
693	hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
694	$(FROM_OBJ) fix_options.o socket.o tli.o workarounds.o \
695	update.o misc.o diag.o percent_m.o myvsyslog.o
696
697FROM_OBJ= fromhost.o
698
699KIT	= README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
700	tcpd.h tcpdmatch.c Makefile hosts_access.5 strcasecmp.c BLURB rfc931.c \
701	tcpd.8 eval.c hosts_access.3 hosts_ctl.c percent_x.c options.c \
702	clean_exit.c environ.c patchlevel.h fix_options.c workarounds.c \
703	socket.c tli.c DISCLAIMER fakelog.c safe_finger.c hosts_options.5 \
704	CHANGES try-from.c update.c ptx.c vfprintf.c tli-sequent.c \
705	tli-sequent.h misc.c diag.c ncr.c tcpdchk.c percent_m.c \
706	myvsyslog.c mystdarg.h printf.ck README.IRIX Banners.Makefile \
707	refuse.c tcpdchk.8 setenv.c inetcf.c inetcf.h scaffold.c \
708	scaffold.h tcpdmatch.8 README.NIS
709
710LIB	= libwrap.a
711
712all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
713
714# Invalidate all object files when the compiler options (CFLAGS) have changed.
715
716config-check:
717	@set +e; test -n "$(REAL_DAEMON_DIR)" || { make; exit 1; }
718	@set +e; echo $(CFLAGS) >/tmp/cflags.$$$$ ; \
719	if cmp cflags /tmp/cflags.$$$$ ; \
720	then rm /tmp/cflags.$$$$ ; \
721	else mv /tmp/cflags.$$$$ cflags ; \
722	fi >/dev/null 2>/dev/null
723
724$(LIB):	$(LIB_OBJ)
725	rm -f $(LIB)
726	$(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
727	-$(RANLIB) $(LIB)
728
729tcpd:	tcpd.o $(LIB)
730	$(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
731
732miscd:	miscd.o $(LIB)
733	$(CC) $(CFLAGS) -o $@ miscd.o $(LIB) $(LIBS)
734
735safe_finger: safe_finger.o $(LIB)
736	$(CC) $(CFLAGS) -o $@ safe_finger.o $(LIB) $(LIBS)
737
738TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
739
740tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
741	$(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(LIB) $(LIBS)
742
743try-from: try-from.o fakelog.o $(LIB)
744	$(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(LIB) $(LIBS)
745
746TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
747
748tcpdchk: $(TCPDCHK_OBJ) $(LIB)
749	$(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(LIB) $(LIBS)
750
751shar:	$(KIT)
752	@shar $(KIT)
753
754kit:	$(KIT)
755	@makekit $(KIT)
756
757files:
758	@echo $(KIT)
759
760archive:
761	$(ARCHIVE) $(KIT)
762
763clean:
764	rm -f tcpd miscd safe_finger tcpdmatch tcpdchk try-from *.[oa] core \
765	cflags
766
767tidy:	clean
768	chmod -R a+r .
769	chmod 755 .
770
771# Enable all bells and whistles for linting.
772
773lint: tcpd_lint miscd_lint match_lint chk_lint
774
775tcpd_lint:
776	lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
777	-DGETPEERNAME_BUG -DDAEMON_UMASK=022 -DSEVERITY=$(SEVERITY) \
778	$(TABLES) -DKILL_IP_OPTIONS -DPROCESS_OPTIONS \
779	-DRFC931_TIMEOUT=$(RFC931_TIMEOUT) -DALWAYS_RFC931 \
780	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
781	-Dvsyslog=myvsyslog \
782	tcpd.c fromhost.c socket.c tli.c hosts_access.c \
783	shell_cmd.c refuse.c rfc931.c eval.c percent_x.c clean_exit.c \
784	options.c setenv.c fix_options.c workarounds.c update.c misc.c \
785	diag.c myvsyslog.c percent_m.c
786
787miscd_lint:
788	lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
789	-DGETPEERNAME_BUG -DDAEMON_UMASK=022 -DSEVERITY=$(SEVERITY) \
790	$(TABLES) -DKILL_IP_OPTIONS -DPROCESS_OPTIONS \
791	-DRFC931_TIMEOUT=$(RFC931_TIMEOUT) -DALWAYS_RFC931 \
792	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
793	-Dvsyslog=myvsyslog \
794	miscd.c fromhost.c socket.c tli.c hosts_access.c \
795	shell_cmd.c refuse.c rfc931.c eval.c percent_x.c clean_exit.c \
796	options.c setenv.c fix_options.c workarounds.c update.c misc.c \
797	diag.c myvsyslog.c percent_m.c
798
799match_lint:
800	lint -DFACILITY=LOG_MAIL -DSEVERITY=$(SEVERITY) -DHOSTS_ACCESS \
801	-DPARANOID $(TABLES) -DNETGROUP -DPROCESS_OPTIONS -DRFC931_TIMEOUT=10 \
802	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
803	-Dvsyslog=myvsyslog \
804	tcpdmatch.c hosts_access.c eval.c percent_x.c options.c workarounds.c \
805	update.c socket.c misc.c diag.c myvsyslog.c percent_m.c setenv.c \
806	inetcf.c scaffold.c
807
808chk_lint:
809	lint -DFACILITY=LOG_MAIL -DSEVERITY=$(SEVERITY) -DHOSTS_ACCESS \
810	-DPARANOID $(TABLES) -DNETGROUP -DPROCESS_OPTIONS -DRFC931_TIMEOUT=10 \
811	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
812	-Dvsyslog=myvsyslog \
813	tcpdchk.c eval.c percent_x.c options.c update.c workarounds.c \
814	setenv.c misc.c diag.c myvsyslog.c percent_m.c inetcf.c scaffold.c
815
816printfck:
817	printfck -f printf.ck \
818	tcpd.c fromhost.c socket.c tli.c hosts_access.c \
819	shell_cmd.c refuse.c rfc931.c eval.c percent_x.c clean_exit.c \
820	options.c setenv.c fix_options.c workarounds.c update.c misc.c \
821	diag.c myvsyslog.c percent_m.c >aap.c
822	lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
823	-DGETPEERNAME_BUG -DDAEMON_UMASK=022 -DSEVERITY=$(SEVERITY) \
824	$(TABLES) -DKILL_IP_OPTIONS -DPROCESS_OPTIONS \
825	-DRFC931_TIMEOUT=$(RFC931_TIMEOUT) -DALWAYS_RFC931 \
826	-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" -Dvsyslog=myvsyslog aap.c
827	printfck -f printf.ck \
828	tcpdchk.c eval.c percent_x.c options.c update.c workarounds.c \
829	setenv.c misc.c diag.c myvsyslog.c percent_m.c inetcf.c scaffold.c \
830	>aap.c
831	lint -DFACILITY=LOG_MAIL -DSEVERITY=$(SEVERITY) -DHOSTS_ACCESS \
832	-DPARANOID $(TABLES) -DNETGROUP -DPROCESS_OPTIONS -DRFC931_TIMEOUT=10 \
833	-Dvsyslog=myvsyslog -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\"
834
835# Internal compilation dependencies.
836
837clean_exit.o: cflags
838clean_exit.o: tcpd.h
839diag.o: cflags
840diag.o: mystdarg.h
841diag.o: tcpd.h
842environ.o: cflags
843eval.o: cflags
844eval.o: tcpd.h
845fakelog.o: cflags
846fakelog.o: mystdarg.h
847fix_options.o: cflags
848fix_options.o: tcpd.h
849fromhost.o: cflags
850fromhost.o: tcpd.h
851hosts_access.o: cflags
852hosts_access.o: tcpd.h
853hosts_ctl.o: cflags
854hosts_ctl.o: tcpd.h
855inetcf.o: cflags
856inetcf.o: inetcf.h
857inetcf.o: tcpd.h
858misc.o: cflags
859misc.o: tcpd.h
860miscd.o: cflags
861miscd.o: patchlevel.h
862miscd.o: tcpd.h
863myvsyslog.o: cflags
864myvsyslog.o: mystdarg.h
865myvsyslog.o: tcpd.h
866ncr.o: cflags
867ncr.o: tcpd.h
868options.o: cflags
869options.o: tcpd.h
870percent_m.o: cflags
871percent_m.o: mystdarg.h
872percent_x.o: cflags
873percent_x.o: tcpd.h
874ptx.o: cflags
875ptx.o: tcpd.h
876refuse.o: cflags
877refuse.o: tcpd.h
878rfc931.o: cflags
879rfc931.o: tcpd.h
880safe_finger.o: cflags
881scaffold.o: cflags
882scaffold.o: scaffold.h
883scaffold.o: tcpd.h
884setenv.o: cflags
885shell_cmd.o: cflags
886shell_cmd.o: tcpd.h
887socket.o: cflags
888socket.o: tcpd.h
889strcasecmp.o: cflags
890tcpd.o: cflags
891tcpd.o: patchlevel.h
892tcpd.o: tcpd.h
893tcpdchk.o: cflags
894tcpdchk.o: inetcf.h
895tcpdchk.o: scaffold.h
896tcpdchk.o: tcpd.h
897tcpdmatch.o: cflags
898tcpdmatch.o: scaffold.h
899tcpdmatch.o: tcpd.h
900tli-sequent.o: cflags
901tli-sequent.o: tcpd.h
902tli-sequent.o: tli-sequent.h
903tli.o: cflags
904tli.o: tcpd.h
905try-from.o: cflags
906try-from.o: tcpd.h
907update.o: cflags
908update.o: mystdarg.h
909update.o: tcpd.h
910vfprintf.o: cflags
911workarounds.o: cflags
912workarounds.o: tcpd.h
913