1# ========================================================================
2# Copyright 1988-2007 University of Washington
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10#
11# ========================================================================
12
13# Program:	C client makefile
14#
15# Author:	Mark Crispin
16#		Networks and Distributed Computing
17#		Computing & Communications
18#		University of Washington
19#		Administration Building, AG-44
20#		Seattle, WA  98195
21#		Internet: MRC@CAC.Washington.EDU
22#
23# Date:		11 May 1989
24# Last Edited:	17 December 2007
25
26
27# Command line build parameters
28
29EXTRAAUTHENTICATORS=
30EXTRADRIVERS=mbox
31PASSWDTYPE=pam
32SSLTYPE=unix.nopwd
33IP=6
34
35
36# The optimization level here for GCC ports is set here for a reason.  It's
37# to get you to read this text.
38# The general concensus seems to be that -O2 is the one to use.
39# Over the years, I've been told to use many different settings, including -O6.
40# In recent versions of GCC [as of 2/2005], -O6 generates bad code that, among
41# other ill effects, causes infinite loops.
42# -O3 seems to be safe, but empirical observation from our local expert
43# indicates that in some (many?) cases -O3 code runs slower than -O2.
44
45GCCOPTLEVEL= -O2
46
47
48# Try to have some consistency in GCC builds.  We want optimization, but we
49# also want to be able to debug.
50
51GCCCFLAGS= -g $(GCCOPTLEVEL) -pipe -fno-omit-frame-pointer
52GCC4CFLAGS= $(GCCCFLAGS) -Wno-pointer-sign
53
54
55# Extended flags needed for SSL.  You may need to modify.
56
57#SSLDIR=/usr/local/ssl
58SSLCERTS=$(PREFIX)/certs
59SSLKEYS=$(SSLCERTS)
60SSLINCLUDE=$(SSLDIR)/include
61SSLLIB=$(SSLDIR)/lib
62
63SSLCRYPTO=-lcrypto -lcrypt
64
65# Older versions of MIT Kerberos also have a libcrypto.  If so, you may need
66# to use this instead
67#SSLCRYPTO=$(SSLLIB)/libcrypto.a
68
69# RSA Security Inc. released the RSA public key encryption algorithm into
70# the public domain on September 6, 2000.  There is no longer any need to
71# use RSAREF.
72SSLRSA= # -lRSAglue -lrsaref
73
74SSLCFLAGS= -I$(SSLINCLUDE) -I$(SSLINCLUDE)/openssl\
75 -DSSL_CERT_DIRECTORY=\"$(SSLCERTS)\" -DSSL_KEY_DIRECTORY=\"$(SSLKEYS)\"
76SSLLDFLAGS= -L$(SSLLIB) -lssl $(SSLCRYPTO) $(SSLRSA)
77
78
79# Extended flags needed for non-standard passwd types.  You may need to modify.
80
81AFSDIR=/usr/afsws
82AFSCFLAGS=-I$(AFSDIR)/include
83AFSLIB=$(AFSDIR)/lib
84AFSLDFLAGS=-L$(AFSLIB)/afs -L$(AFSLIB) -L$(AFSDIR)/domestic/lib\
85 -lkauth -lprot -lubik -lauth -lrxkad -lrx -llwp -ldes -lcom_err\
86 $(AFSLIB)/afs/util.a -laudit -lsys
87# AFSLDFLAGS may also need -L/usr/ucblib -lucb
88DCECFLAGS= -DDCE_MINIMAL -DPASSWD_OVERRIDE=\"/opt/pop3/passwd/passwd\"
89DCELDFLAGS= -ldce
90PAMLDFLAGS= # -lpam -lcrypt
91
92
93# Build parameters normally set by the individual port
94
95CHECKPW=std
96LOGINPW=std
97SIGTYPE=bsd
98CRXTYPE=std
99ACTIVEFILE=/usr/lib/news/active
100SPOOLDIR=/usr/spool
101MAILSPOOL=$(SPOOLDIR)/mail
102NEWSSPOOL=$(SPOOLDIR)/news
103RSHPATH=/usr/ucb/rsh
104MD5PWD=/etc/cram-md5.pwd
105# Tries one of the test alternatives below if not specified.
106LOCKPGM=
107# Test alternatives if LOCKPGM not specified
108LOCKPGM1=/usr/libexec/mlock
109LOCKPGM2=/usr/sbin/mlock
110LOCKPGM3=/etc/mlock
111
112
113# Default formats for creating new mailboxes and for empty mailboxes in the
114# default namespace; must be set to the associated driver's prototype.
115#
116# The CREATEPROTO is the default format for new mailbox creation.
117# The EMPTYPROTO is the default format for handling zero-byte files.
118#
119# Normally, this is set by the individual port.
120#
121# NOTE: namespace formats (e.g. mh and news) can not be set as a default format
122# since they do not exist in the default namespace.  Also, it is meaningless to
123# set certain other formats (e.g. mbx, mx, and mix) as the EMPTYPROTO since
124# these formats can never be empty files.
125
126CREATEPROTO=unixproto
127EMPTYPROTO=unixproto
128
129
130# Commands possibly overriden by the individual port
131
132ARRC=ar rc
133#CC=cc
134LN=ln -s
135RANLIB=ranlib
136
137
138# Standard distribution build parameters
139
140DEFAULTAUTHENTICATORS=ext md5 pla log
141#
142# mh needs to be after any other directory format drivers (such as mx or mix)
143# since otherwise mh will seize any directory that is under the mh path.
144# However, mh needs to be before any sysinbox formats (such as mmdf or unix)
145# since otherwise INBOX won't work correctly when mh_allow_inbox is set.
146#
147DEFAULTDRIVERS=imap nntp pop3 mix mx mbx tenex mtx mh mmdf unix news phile
148CHUNKSIZE=65536
149
150# Normally no need to change any of these
151
152ARCHIVE=c-client.a
153BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \
154 dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
155 rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
156 unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
157CFLAGS+=$(BASECFLAGS) $(EXTRACFLAGS)
158
159CAT=cat
160MAKE=make
161MV=mv
162RM=rm -rf
163SH=sh
164
165
166# Primary build command
167
168BUILD=$(MAKE) build EXTRACFLAGS='$(EXTRACFLAGS)'\
169 EXTRALDFLAGS='$(EXTRALDFLAGS)'\
170 EXTRADRIVERS='$(EXTRADRIVERS)' EXTRAAUTHENTICATORS='$(EXTRAAUTHENTICATORS)'\
171 PASSWDTYPE=$(PASSWDTYPE) SSLTYPE=$(SSLTYPE) IP=$(IP)
172
173
174# Need this for the shared library rule to work correctly
175.SUFFIXES: .o .so
176SOFILES=${BINARIES:.o=.so}
177
178# Here if no make argument established
179
180missing: osdep.h
181	$(MAKE) all `$(CAT) SPECIALS`
182
183osdep.h:
184	@echo You must specify what type of system
185	@false
186
187
188# Current ports
189
190a32:	# AIX 3.2 for RS/6000
191	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
192	 SIGTYPE=psx CRXTYPE=nfs \
193	 SPOOLDIR=/var/spool \
194	 RSHPATH=/usr/bin/rsh \
195	 BASECFLAGS="-g -Dunix=1 -D_BSD" \
196	 BASELDFLAGS="-lbsd"
197
198a41:	# AIX 4.1 for RS/6000
199	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
200	 SIGTYPE=psx CHECKPW=a41 CRXTYPE=nfs \
201	 SPOOLDIR=/var/spool \
202	 RSHPATH=/usr/bin/rsh \
203	 BASECFLAGS="-g -Dunix=1 -D_BSD -qro -qroconst" \
204	 BASELDFLAGS="-ls"
205
206a52:	# Attempt at AIX 5.2
207	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
208	 SIGTYPE=psx CHECKPW=a41 CRXTYPE=nfs \
209	 SPOOLDIR=/var/spool \
210	 RSHPATH=/usr/bin/rsh \
211	 BASECFLAGS="-g -Dunix=1 -D_BSD -qro -qroconst" \
212	 BASELDFLAGS="-ls"
213
214aix:	# AIX/370
215	@echo You are building for AIX on an S/370 class machine
216	@echo If you want AIX on an RS/6000 you need to use a32 or a41 instead!
217	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
218	 CRXTYPE=nfs \
219	 BASECFLAGS="-g" \
220	 BASELDFLAGS="-lbsd"
221
222aos:	# AOS for RT
223	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
224	 CRXTYPE=nfs \
225	 BASECFLAGS="-g -Dconst="
226
227art:	# AIX 2.2.1 for RT
228	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
229	 SIGTYPE=sv4 \
230	 SPOOLDIR=/var \
231	 ACTIVEFILE=/usr/local/news/control/active \
232	 RSHPATH=/bin/rsh \
233	 BASECFLAGS="-g -Dconst= -Dvoid=char" \
234	 RANLIB=true
235
236asv:	# Altos SVR4
237	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
238	 SIGTYPE=sv4 LOGINPW=old \
239	 ACTIVEFILE=/usr/spool/news/active \
240	 RSHPATH=/usr/bin/rcmd \
241	 BASECFLAGS="-Dconst= -DSIGSTOP=SIGKILL" \
242	 BASELDFLAGS="-lsocket -lrpc -lgen -lcrypt -lxenix" \
243	 RANLIB=true
244
245aux:	# A/UX
246	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
247	 CRXTYPE=nfs \
248	 MAILSPOOL=/usr/mail \
249	 BASECFLAGS="-g -B/usr/lib/big/ -Dvoid=char -Dconst=" \
250	 RANLIB=true ARRC="ar -rc"
251
252bs3:	# BSD/i386 3.0 or higher
253	$(BUILD) `$(CAT) SPECIALS` OS=bsi \
254	 CHECKPW=bsi LOGINPW=bsi CRXTYPE=nfs \
255	 SPOOLDIR=/var NEWSSPOOL=/var/news/spool \
256	 ACTIVEFILE=/var/news/etc/active \
257	 RSHPATH=/usr/bin/rsh \
258	 BASECFLAGS="$(GCCCFLAGS)" CC=shlicc
259
260bsd:	# BSD UNIX
261	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
262	 CRXTYPE=nfs \
263	 BASECFLAGS="-g -Dconst="
264
265bsf:	# FreeBSD
266	$(BUILD) `$(CAT) SPECIALS` OS=$@ CHECKPW=pam \
267	 SIGTYPE=psx CRXTYPE=nfs \
268	 SPOOLDIR=/var \
269	 ACTIVEFILE=/usr/local/news/lib/active \
270	 RSHPATH=/usr/bin/rsh \
271	 LOCKPGM=$(PREFIX)/libexec/mlock \
272	 BASECFLAGS="$(GCCCFLAGS)" \
273	 BASELDFLAGS="-lpam"
274
275bsi:	# BSD/i386
276	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
277	 CRXTYPE=nfs \
278	 SPOOLDIR=/var NEWSSPOOL=/var/news/spool \
279	 ACTIVEFILE=/var/news/etc/active \
280	 RSHPATH=/usr/bin/rsh \
281	 BASECFLAGS="$(GCCCFLAGS)"
282
283bso:	# OpenBSD
284	$(BUILD) `$(CAT) SPECIALS` OS=bsi \
285	 SIGTYPE=psx CRXTYPE=nfs \
286	 SPOOLDIR=/var \
287	 ACTIVEFILE=/usr/local/news/lib/active \
288	 RSHPATH=/usr/bin/rsh \
289	 BASECFLAGS="$(GCCCFLAGS)"
290
291cvx:	# Convex
292	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
293	 CRXTYPE=nfs \
294	 BASECFLAGS="-O -ext -Dconst="
295
296cyg:	# Cygwin - note that most local file drivers don't work!!
297	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
298	DEFAULTDRIVERS="imap nntp pop3 mbx unix phile" \
299	SIGTYPE=psx CHECKPW=cyg LOGINPW=cyg CRXTYPE=std \
300	SPOOLDIR=/var \
301	ACTIVEFILE=/usr/local/news/lib/active \
302	RSHPATH=/usr/bin/rsh \
303	BASECFLAGS="$(GCCCFLAGS)" \
304	BASELDFLAGS="-lcrypt" \
305	CC=gcc
306
307d-g:	# Data General DG/UX
308	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
309	 SIGTYPE=sv4 CRXTYPE=nfs \
310	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
311	 ACTIVEFILE=/local/news/active \
312	 RSHPATH=/usr/bin/remsh \
313	 BASECFLAGS="-g -Dconst=" \
314	 BASELDFLAGS="-lnsl -lsocket" \
315	 RANLIB=true
316
317d54:	# Data General DG/UX 5.4
318	$(BUILD) `$(CAT) SPECIALS` OS=d-g \
319	 SIGTYPE=sv4 CRXTYPE=nfs \
320	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
321	 ACTIVEFILE=/local/news/active \
322	 RSHPATH=/usr/bin/remsh \
323	 BASECFLAGS="-g -Dconst=" \
324	 BASELDFLAGS="-lnsl -lsocket" \
325	 RANLIB=true
326
327dpx:	# Bull DPX/2
328	$(BUILD) `$(CAT) SPECIALS` OS=sv4 \
329	 SIGTYPE=sv4 CHECKPW=sv4 LOGINPW=sv4 \
330	 RSHPATH=/usr/bin/remsh \
331	 BASECFLAGS="-Dconst= -DSYSTEM5 -DSHORT_IDENT" \
332	 BASELDFLAGS="-linet" \
333	 RANLIB=true LN=ln
334
335drs:	# ICL DRS/NX
336	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
337	 SIGTYPE=sv4 CHECKPW=sv4 LOGINPW=sv4 CRXTYPE=nfs \
338	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
339	 ACTIVEFILE=/var/lib/news/active \
340	 RSHPATH=/usr/bin/rsh \
341	 BASECFLAGS="-O" \
342	 BASELDFLAGS="-lsocket -lgen" \
343	 RANLIB=true
344
345do4:	# Apollo Domain/OS sr10.4
346	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
347	 CRXTYPE=nfs \
348	 BASECFLAGS="-A systype,bsd4.3 -D_APOLLO_SOURCE" \
349	 RANLIB=true
350
351dyn:	# Dynix
352	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
353	 CRXTYPE=nfs \
354	 BASECFLAGS="-g -Dconst="
355
356epx:	# EP/IX
357	$(BUILD) `$(CAT) SPECIALS` OS=sv4 \
358	 SIGTYPE=sv4 CHECKPW=sv4 LOGINPW=sv4 \
359	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
360	 ACTIVEFILE=/usr/share/news/active \
361	 RSHPATH=/usr/net/rsh \
362	 BASECFLAGS="-g -systype svr4" \
363	 BASELDFLAGS="-lsocket -lnsl -lgen" \
364	 RANLIB=true
365
366ga4:	# GCC AIX 4.1 for RS/6000
367	$(BUILD) `$(CAT) SPECIALS` OS=a41 \
368	 SIGTYPE=psx CHECKPW=a41 CRXTYPE=nfs \
369	 SPOOLDIR=/var/spool \
370	 RSHPATH=/usr/bin/rsh \
371	 BASECFLAGS="-g -Dunix=1 -D_BSD" \
372	 BASELDFLAGS="-ls"
373
374gas:	# GCC Altos SVR4
375	$(BUILD) `$(CAT) SPECIALS` OS=asv \
376	 SIGTYPE=sv4 LOGINPW=old \
377	 ACTIVEFILE=/usr/spool/news/active \
378	 RSHPATH=/usr/bin/rcmd \
379	 BASECFLAGS="-g -O -DALTOS_SYSTEM_V -DSIGSTOP=SIGKILL" \
380	 BASELDFLAGS="-lsocket -lrpc -lgen -lcrypt -lxenix" \
381	 RANLIB=true CC=gcc
382
383gh9:	# GCC HP-UX 9.x
384	$(BUILD) `$(CAT) SPECIALS` OS=hpp \
385	 SIGTYPE=psx CRXTYPE=nfs \
386	 MAILSPOOL=/usr/mail \
387	 RSHPATH=/usr/bin/remsh \
388	 BASECFLAGS="$(GCCCFLAGS)" \
389	 RANLIB=true CC=gcc
390
391ghp:	# GCC HP-UX 10.x
392	$(BUILD) `$(CAT) SPECIALS` OS=hpp \
393	 SIGTYPE=psx CRXTYPE=nfs \
394	 SPOOLDIR=/var \
395	 ACTIVEFILE=/var/news/active \
396	 RSHPATH=/usr/bin/remsh \
397	 BASECFLAGS="$(GCCCFLAGS)" \
398	 RANLIB=true CC=gcc
399
400ghs:	# GCC HP-UX with Trusted Computer Base
401	$(BUILD) `$(CAT) SPECIALS` OS=shp \
402	 SIGTYPE=psx CHECKPW=sec CRXTYPE=nfs \
403	 SPOOLDIR=/var \
404	 ACTIVEFILE=/var/news/active \
405	 RSHPATH=/usr/bin/remsh \
406	 BASECFLAGS="$(GCCCFLAGS)" \
407	 BASELDFLAGS="-lnet -lV3 -lsec" \
408	 RANLIB=true CC=gcc
409
410go5:	# GCC 2.7.1 (95q4) SCO Open Server 5.0.x
411	$(BUILD) `$(CAT) SPECIALS` OS=sc5 \
412	 SIGTYPE=psx CHECKPW=sec LOGINPW=sec \
413	 CREATEPROTO=mmdfproto EMPTYPROTO=mmdfproto \
414	 SPOOLDIR=/var/spool \
415	 ACTIVEFILE=/var/lib/news/active \
416	 RSHPATH=/usr/bin/rcmd \
417	 BASECFLAGS="$(GCCCFLAGS) -I/usr/include -L/lib" \
418	 BASELDFLAGS="-lsocket -lprot -lx -ltinfo -lm" \
419	 RANLIB=true CC=gcc
420
421gsc:	# Santa Cruz Operation
422	$(BUILD) `$(CAT) SPECIALS` OS=sco \
423	 SIGTYPE=sv4 CHECKPW=sec LOGINPW=sec \
424	 CREATEPROTO=mmdfproto EMPTYPROTO=mmdfproto \
425	 RSHPATH=/usr/bin/rcmd \
426	 BASECFLAGS="$(GCCCFLAGS)" \
427	 BASELDFLAGS="-lsocket -lprot -lcrypt_i -lx -los" \
428	 RANLIB=true LN=ln CC=gcc
429
430gsg:	# GCC Silicon Graphics
431	$(BUILD) `$(CAT) SPECIALS` OS=sgi \
432	 SIGTYPE=sv4 CRXTYPE=nfs \
433	 MAILSPOOL=/usr/mail \
434	 RSHPATH=/usr/bsd/rsh \
435	 BASECFLAGS="$(GCCCFLAGS)" \
436	 RANLIB=true CC=gcc
437
438gso:	os_sol.h	# GCC Solaris
439	$(BUILD) `$(CAT) SPECIALS` OS=sol \
440	 SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
441	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
442	 ACTIVEFILE=/usr/share/news/active \
443	 RSHPATH=/usr/bin/rsh \
444	 BASECFLAGS="$(GCCCFLAGS)" \
445	 BASELDFLAGS="-lsocket -lnsl -lgen" \
446	 RANLIB=true CC=gcc
447
448gsu:	# GCC SUN-OS
449	$(BUILD) `$(CAT) SPECIALS` OS=sun \
450	 CRXTYPE=nfs \
451	 BASECFLAGS="$(GCCCFLAGS)" \
452	 BASELDFLAGS="-ldl" \
453	 CC=gcc
454
455gul:	# GCC Ultrix
456	$(BUILD) `$(CAT) SPECIALS` OS=ult \
457	 SIGTYPE=psx CHECKPW=ult CRXTYPE=nfs \
458	 BASECFLAGS="$(GCCCFLAGS)" \
459	 BASELDFLAGS="-lauth -lc" \
460	 CC=gcc
461
462h11:	# HP-UX 11i
463	$(BUILD) `$(CAT) SPECIALS` OS=hpp \
464	 SIGTYPE=psx CRXTYPE=nfs \
465	 SPOOLDIR=/var \
466	 ACTIVEFILE=/var/news/active \
467	 RSHPATH=/usr/bin/remsh \
468	 BASECFLAGS="-g -Ae" \
469	 RANLIB=true
470
471hpp:	# HP-UX 9.x
472	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
473	 SIGTYPE=psx CRXTYPE=nfs \
474	 MAILSPOOL=/usr/mail \
475	 RSHPATH=/usr/bin/remsh \
476	 BASECFLAGS="-g -Aa -D_HPUX_SOURCE" \
477	 BASELDFLAGS="-lnet -lV3" \
478	 RANLIB=true
479
480hpx:	# HP-UX 10.x
481	$(BUILD) `$(CAT) SPECIALS` OS=hpp \
482	 SIGTYPE=psx CRXTYPE=nfs \
483	 SPOOLDIR=/var \
484	 ACTIVEFILE=/var/news/active \
485	 RSHPATH=/usr/bin/remsh \
486	 BASECFLAGS="-g -Ae" \
487	 BASELDFLAGS="-lnet -lV3" \
488	 RANLIB=true
489
490isc:	# Interactive
491	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
492	 SIGTYPE=sv4 CHECKPW=sv4 LOGINPW=sv4 \
493	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
494	 ACTIVEFILE=/var/spool/news/active \
495	 BASECFLAGS="-Xp -D_SYSV3" \
496	 BASELDFLAGS="-linet -lnsl_s -lgen -lx -lsec -liberty" \
497	 RANLIB=true
498
499lnp:	# Linux Pluggable Authentication modules
500	$(BUILD) `$(CAT) SPECIALS` OS=slx \
501	 SIGTYPE=psx CHECKPW=pam CRXTYPE=nfs \
502	 SPOOLDIR=/var/spool \
503	 ACTIVEFILE=/var/lib/news/active \
504	 RSHPATH=/usr/bin/rsh \
505	 BASECFLAGS="$(GCCCFLAGS)" \
506	 BASELDFLAGS="$(PAMLDFLAGS)"
507
508lnx:	# Linux non-shadow passwords
509	@echo You are building for traditional Linux *without* shadow
510	@echo passwords and with the crypt function in the C library.
511	@echo If your system has shadow passwords, or if crypt is not
512	@echo in the C library, you must use slx, sl4, or sl5 instead!
513	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
514	 SIGTYPE=psx CRXTYPE=nfs \
515	 SPOOLDIR=/var/spool \
516	 ACTIVEFILE=/var/lib/news/active \
517	 RSHPATH=/usr/bin/rsh \
518	 BASECFLAGS="$(GCCCFLAGS)"
519
520lyn:	# LynxOS
521	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
522	 CRXTYPE=nfs \
523	 RSHPATH=/bin/rsh \
524	 BASECFLAGS="$(GCCCFLAGS)" \
525	 BASELDFLAGS=-lbsd \
526	 CC=gcc
527
528mct:	# MachTen - CRXTYPE=nfs doesn't work (at least not on 2.2)
529	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
530	 SPOOLDIR=/var/spool \
531	 BASECFLAGS="$(GCCCFLAGS)"
532
533mnt:	# Mint
534	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
535	 SIGTYPE=psx CRXTYPE=nfs \
536	 SPOOLDIR=/var/spool \
537	 ACTIVEFILE=/var/lib/news/active \
538	 RSHPATH=/usr/bin/rsh \
539	 BASECFLAGS="$(GCCCFLAGS)"
540
541neb:	# NetBSD
542	$(BUILD) `$(CAT) SPECIALS` OS=bsi \
543	 CRXTYPE=nfs \
544	 SPOOLDIR=/var \
545	 ACTIVEFILE=/var/db/news/active \
546	 RSHPATH=/usr/bin/rsh \
547	 BASECFLAGS="$(GCCCFLAGS)" \
548	 BASELDFLAGS="-lcrypt"
549
550nec:	# NEC UX
551	$(BUILD) `$(CAT) SPECIALS` OS=sv4 \
552	 SIGTYPE=sv4 CHECKPW=sv4 \
553	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
554	 ACTIVEFILE=/var/news/lib/active \
555	 RSHPATH=/usr/bin/rsh \
556	 BASECFLAGS="-g -Kopt=2 -KOlimit=2000" \
557	 BASELDFLAGS="-lsocket -lnsl -lgen" \
558	 RANLIB=true CC=/usr/abiccs/bin/cc
559
560nto:	# QNX Neutrino RTP
561	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
562	 CRXTYPE=nfs \
563	 SPOOLDIR=/var/spool \
564	 ACTIVEFILE=/var/lib/news/active \
565	 RSHPATH=/usr/bin/rsh \
566	 BASECFLAGS="-g -O"
567
568nxt:	# NEXTSTEP
569	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
570	 CRXTYPE=nfs \
571	 BASECFLAGS="$(GCCCFLAGS)"
572
573nx3:	# NEXTSTEP 3.0 single threaded
574	$(BUILD) `$(CAT) SPECIALS` OS=nxt \
575	 CRXTYPE=nfs \
576	 BASECFLAGS="$(GCCCFLAGS)"
577	echo "void malloc_singlethreaded (void);" >> linkage.h
578	echo "  malloc_singlethreaded ();" >> linkage.c
579
580osf:	# OSF/1
581	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
582	 SIGTYPE=psx CRXTYPE=nfs \
583	 SPOOLDIR=/var/spool \
584	 BASECFLAGS="-g3 -w -O2 -Olimit 1500"
585
586# Note: sia_become_user() used by LOGINPW=os4 doesn't seem to work right.  The
587# user doesn't get proper file access, and the process can't be killed.
588
589os4:	# OSF/1 (Digital UNIX) 4
590	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
591	 SIGTYPE=psx CHECKPW=os4 LOGINPW=os4 CRXTYPE=nfs \
592	 SPOOLDIR=/var/spool \
593	 BASECFLAGS="-g3 -w -std0 -O2"
594
595osx:	# Mac OS X
596	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
597	 CRXTYPE=nfs \
598	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
599	 RSHPATH=/usr/bin/rsh \
600	 BASECFLAGS="$(GCC4CFLAGS)"
601
602ptx:	# PTX
603	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
604	 SIGTYPE=psx CHECKPW=svo LOGINPW=sv4 CRXTYPE=nfs \
605	 MAILSPOOL=/usr/mail \
606	 RSHPATH=/usr/bin/resh \
607	 BASECFLAGS="-Wc,-O3 -Wc,-seq -Dprivate=PRIVATE" \
608	 BASELDFLAGS="-lseq -lsec -lsocket -linet -lnsl -lgen" \
609	 RANLIB=true
610
611pyr:	# Pyramid
612	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
613	 CRXTYPE=nfs \
614	 BASECFLAGS="-g -Dconst="
615
616qnx:	# QNX
617	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
618	 CHECKPW=psx LOGINPW=old \
619	 RSHPATH=/usr/ucb/rsh \
620	 BASECFLAGS="-Otax -g -Dunix=1 -D_POSIX_SOURCE" \
621	 BASELDFLAGS="-g -N128k -llogin -lsocket -lunix"
622
623s40:	# SUN-OS 4.0
624	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
625	 CRXTYPE=nfs \
626	 BASECFLAGS="-g -Dconst="
627
628sc5:	# SCO Open Server 5.0
629	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
630	 SIGTYPE=psx CHECKPW=sec LOGINPW=sec \
631	 CREATEPROTO=mmdfproto EMPTYPROTO=mmdfproto \
632	 SPOOLDIR=/var/spool \
633	 ACTIVEFILE=/var/lib/news/active \
634	 RSHPATH=/usr/bin/rcmd \
635	 BASECFLAGS="-O3 -s -belf" \
636	 BASELDFLAGS="-lsocket -lprot -lx -ltinfo -lm" \
637	 RANLIB=true
638
639sco:	# Santa Cruz Operation
640	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
641	 SIGTYPE=sv4 CHECKPW=sec LOGINPW=sec \
642	 CREATEPROTO=mmdfproto EMPTYPROTO=mmdfproto \
643	 RSHPATH=/usr/bin/rcmd \
644	 BASECFLAGS="-O3" \
645	 BASELDFLAGS="-lsocket -lprot -lcrypt_i -lx -los" \
646	 RANLIB=true LN=ln
647
648# Note: setting _POSIX_SOURCE doesn't seem to build it as of SGI IRIX 5.3
649
650sgi:	# Silicon Graphics
651	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
652	 SIGTYPE=sv4 CRXTYPE=nfs \
653	 MAILSPOOL=/usr/mail \
654	 RSHPATH=/usr/bsd/rsh \
655	 BASECFLAGS="-g3 -O2 -Olimit 8192" \
656	 RANLIB=true
657
658sg6:	# Silicon Graphics, IRIX 6.5
659	MAKEFLAGS= $(BUILD) `$(CAT) SPECIALS` OS=sgi \
660	 SIGTYPE=sv4 CRXTYPE=nfs \
661	 MAILSPOOL=/usr/mail \
662	 RSHPATH=/usr/bsd/rsh \
663	 BASECFLAGS="-g3 -O2 -OPT:Olimit=0 -woff 1110,1116" \
664	 RANLIB=true
665
666# Note: Mark Kaesling says that setluid() isn't in HP-UX with SecureWare.
667
668shp:	# HP-UX with Trusted Computer Base
669	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
670	 SIGTYPE=psx CHECKPW=sec CRXTYPE=nfs \
671	 SPOOLDIR=/var \
672	 ACTIVEFILE=/var/news/active \
673	 RSHPATH=/usr/bin/remsh \
674	 BASECFLAGS="-g -Ae" \
675	 BASELDFLAGS="-lnet -lV3 -lsec" \
676	 RANLIB=true
677
678slx:	# Secure Linux
679	@echo You are building for libc6/glibc versions of Secure Linux
680	@echo If you want libc5 versions you must use sl5 instead!
681	@echo If you want libc4 versions you must use sl4 instead!
682	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
683	 SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
684	 SPOOLDIR=/var/spool \
685	 ACTIVEFILE=/var/lib/news/active \
686	 RSHPATH=/usr/bin/rsh \
687	 BASECFLAGS="$(GCCCFLAGS)" \
688	 BASELDFLAGS="-lcrypt"
689
690sl4:	# Secure Linux using libc4
691	@echo You are building for libc4 versions of Secure Linux
692	@echo If you want libc6/glibc versions you must use slx instead!
693	@echo If you want libc5 versions you must use sl5 instead!
694	$(BUILD) `$(CAT) SPECIALS` OS=slx \
695	 SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
696	 SPOOLDIR=/var/spool \
697	 ACTIVEFILE=/var/lib/news/active \
698	 RSHPATH=/usr/bin/rsh \
699	 BASECFLAGS="$(GCCCFLAGS)" \
700	 BASELDFLAGS="-lshadow"
701
702sl5:	# Secure Linux using libc5
703	@echo You are building for libc5 versions of Secure Linux
704	@echo If you want libc6/glibc versions you must use slx instead!
705	@echo If you want libc4 versions you must use sl4 instead!
706	$(BUILD) `$(CAT) SPECIALS` OS=slx \
707	 SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
708	 SPOOLDIR=/var/spool \
709	 ACTIVEFILE=/var/lib/news/active \
710	 RSHPATH=/usr/bin/rsh \
711	 BASECFLAGS="$(GCCCFLAGS)"
712
713snx:	# Siemens Nixdorf SINIX and Reliant UNIX
714	$(BUILD) `$(CAT) SPECIALS` OS=sv4 \
715	 SIGTYPE=psx CHECKPW=sv4 \
716	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
717	 ACTIVEFILE=/usr/share/news/active \
718	 RSHPATH=/usr/bin/rsh \
719	 BASECFLAGS="-g -D_SYS_CLOCK_H -Dconst=" \
720	 BASELDFLAGS="-lsocket -lnsl -lgen" \
721	 RANLIB=true
722
723# Sorry about the -w, but the cretinous SUN Workshop Pro C compiler barfs on
724# implicit casts between char and unsigned char.
725
726soc:	os_sol.h	# Solaris with cc
727	$(BUILD) `$(CAT) SPECIALS` OS=sol \
728	 SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
729	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
730	 ACTIVEFILE=/usr/share/news/active \
731	 RSHPATH=/usr/bin/rsh \
732	 BASECFLAGS="-g -O -w" \
733	 BASELDFLAGS="-lsocket -lnsl -lgen" \
734	 RANLIB=true CC=/opt/SUNWspro/bin/cc
735
736
737# Note: It is a long and disgusting story about why cc is set to ucbcc.  You
738# need to invoke the C compiler so that it links with the SVR4 libraries and
739# not the BSD libraries, otherwise readdir() will return the wrong information.
740# Of all the names in the most common path, ucbcc is the only name to be found
741# (on /usr/ccs/bin) that points to a suitable compiler.  cc is likely to be
742# /usr/ucb/cc which is absolutely not the compiler that you want.  The real
743# SVR4 cc is probably something like /opt/SUNWspro/bin/cc which is rarely in
744# anyone's path.
745#
746# ucbcc is probably a link to acc, e.g. /opt/SUNWspro/SC4.0/bin/acc, and is
747# the UCB C compiler using the SVR4 libraries.
748#
749# If ucbcc isn't on your system, then punt on the SUN C compiler and use gcc
750# instead (the gso port instead of the sol port).
751#
752# If, in spite of all the above warnings, you choose to use the "soc" port
753# instead of the "sol" port, be sure to check the behavior of the LIST command
754# in imapd.  Also, note that the "soc" port uses -O.  If you want to use the
755# real SVR4 compiler, you must use -O.  If it works to compile with -O2, then
756# cc is probably using the UCB compiler with BSD libraries, and will not build
757# a good binary
758#
759# To recap:
760# 1) The sol port is designed to be built using the UCB compiler using the
761#    SVR4 libraries.  This compiler is "ucbcc", which is lunk to acc.  You
762#    use -O2 as one of the CFLAGS.
763# 2) If you build the sol port with the UCB compiler using the BSD libraries,
764#    you will get no error messages but you will get bad binaries (the most
765#    obvious symptom is dropping the first two characters return filenames
766#    from the imapd LIST command.  This compiler also uses -O2, and is very
767#    often what the user gets from "cc".  BEWARE!!!
768# 3) If you build the sol port with the real SVR4 compiler, which is often
769#    hidden away or unavailable on many systems, then you will get errors
770#    from -O2 and you need to change that to -O.  But you will get a good
771#    binary.  However, you should try it with -O2 first, to make sure that
772#    you got this compiler and not the UCB compiler using BSD libraries.
773
774sol:	os_sol.h	# Solaris
775	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
776	 SIGTYPE=psx CHECKPW=psx CRXTYPE=nfs \
777	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
778	 ACTIVEFILE=/usr/share/news/active \
779	 RSHPATH=/usr/bin/rsh \
780	 BASECFLAGS="-g -O2" \
781	 BASELDFLAGS="-lsocket -lnsl -lgen" \
782	 RANLIB=true CC=ucbcc
783
784sos:	# Secure OSF/1
785	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
786	 SIGTYPE=psx CHECKPW=sce LOGINPW=sec CRXTYPE=nfs \
787	 BASECFLAGS="-g3 -w -O2 -Olimit 1500" \
788	 BASELDFLAGS="-lsecurity -laud"
789
790ssn:	# Secure SUN-OS
791	$(BUILD) `$(CAT) SPECIALS` OS=sun \
792	 CHECKPW=ssn CRXTYPE=nfs \
793	 BASECFLAGS="-g -Dconst=" \
794	 BASELDFLAGS="-ldl"
795
796sua:	# Windows Vista Subsystem for UNIX Applications
797	$(BUILD) `$(CAT) SPECIALS` OS=sua \
798	 SIGTYPE=psx CRXTYPE=nfs LOGINPW=old \
799	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
800	 ACTIVEFILE=/var/lib/news/active \
801	 RSHPATH=/usr/bin/rsh \
802	 BASECFLAGS="-g -O2" \
803	 BASELDFLAGS="-lcrypt"
804
805sun:	# SUN-OS
806	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
807	 CRXTYPE=nfs \
808	 BASECFLAGS="-g -Dconst=" \
809	 BASELDFLAGS="-ldl"
810
811sv2:	# SVR2
812	@echo You are being *very* optimistic!
813	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
814	 SIGTYPE=sv4 LOGINPW=old \
815	 MAILSPOOL=/usr/mail \
816	 RSHPATH=/usr/bin/remsh \
817	 BASECFLAGS="-Dconst= -DSYSTEM5 -DSHORT_IDENT -I/usr/ethernet/include" \
818	 BASELDFLAGS="-lnet" \
819	 RANLIB=true LN=ln
820
821sv4:	# SVR4
822	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
823	 SIGTYPE=sv4 CHECKPW=sv4 LOGINPW=sv4 \
824	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
825	 ACTIVEFILE=/usr/share/news/active \
826	 RSHPATH=/usr/bin/resh \
827	 BASECFLAGS="-g -Dconst=" \
828	 BASELDFLAGS="-lsocket -lnsl -lgen" \
829	 RANLIB=true
830
831ult:	# Ultrix
832	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
833	 SIGTYPE=psx CHECKPW=ult CRXTYPE=nfs \
834	 BASECFLAGS="-g3 -O2 -Olimit 1500 -Dconst=" \
835	 BASELDFLAGS="-lauth -lc"
836
837uw2:	# UnixWare SVR4.2
838	$(BUILD) `$(CAT) SPECIALS` OS=sv4 \
839	 SIGTYPE=sv4 CHECKPW=sv4 \
840	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
841	 ACTIVEFILE=/var/news/lib/active \
842	 RSHPATH=/usr/bin/rsh \
843	 BASECFLAGS="-g" \
844	 BASELDFLAGS="-lsocket -lnsl -lgen" \
845	 RANLIB=true
846
847vul:	# VAX Ultrix
848	$(BUILD) `$(CAT) SPECIALS` OS=ult \
849	 SIGTYPE=psx CHECKPW=ult CRXTYPE=nfs \
850	 BASECFLAGS="-O2 -Dconst=" \
851	 BASELDFLAGS="-lauth -lc"
852
853vu2:	# VAX Ultrix 2.3, etc.
854	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
855	 CRXTYPE=nfs \
856	 BASECFLAGS="-O2 -Dconst= -Dvoid=char"
857
858
859# Build it!
860
861build:	clean once $(ARCHIVE) $(SHLIBNAME)
862
863all:	$(ARCHIVE) $(SHLIBNAME)
864
865$(ARCHIVE): $(BINARIES)
866	sh -c '$(RM) $(ARCHIVE) || true'
867	@$(CAT) ARCHIVE
868	@$(SH) ARCHIVE
869
870$(SHLIBNAME): $(SOFILES)
871	$(CC) -shared -Wl,-soname=$(SHLIBNAME) -o $(SHLIBNAME) $(SOFILES) `cat LDFLAGS`
872	$(LN) $(SHLIBNAME) lib$(SHLIBBASE).so
873
874.c.so: osdep.h
875	$(CC) -fPIC -DPIC -c `cat CFLAGS` ${@:.so=.c} -o $@
876
877.c.o:
878	$(CC) -c `cat CFLAGS` $*.c
879
880
881# Cleanup
882
883clean:
884	sh -c '$(RM) auths.c crexcl.c ip_unix.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE $(ARCHIVE) || true'
885	sh -c '$(RM) *.so $(SHLIBNAME)'
886
887
888# Dependencies
889
890dummy.o: mail.h misc.h osdep.h dummy.h
891fdstring.o: mail.h misc.h osdep.h fdstring.h
892flstring.o: mail.h misc.h osdep.h flstring.h
893imap4r1.o: mail.h misc.h osdep.h imap4r1.h rfc822.h
894mail.o: mail.h misc.h osdep.h rfc822.h linkage.h
895mbx.o: mail.h misc.h osdep.h dummy.h
896mh.o: mail.h misc.h osdep.h dummy.h
897mix.o: mail.h misc.h osdep.h dummy.h
898mx.o: mail.h misc.h osdep.h dummy.h
899misc.o: mail.h misc.h osdep.h
900mmdf.o: mail.h misc.h osdep.h pseudo.h dummy.h
901mtx.o: mail.h misc.h osdep.h dummy.h
902netmsg.o: mail.h misc.h osdep.h netmsg.h
903news.o: mail.h misc.h osdep.h
904newsrc.o: mail.h misc.h osdep.h newsrc.h
905nntp.o: mail.h misc.h osdep.h netmsg.h smtp.h nntp.h rfc822.h
906phile.o: mail.h misc.h osdep.h rfc822.h dummy.h
907pseudo.o: pseudo.h
908pop3.o: mail.h misc.h osdep.h rfc822.h
909smanager.o: mail.h misc.h osdep.h
910smtp.o: mail.h misc.h osdep.h smtp.h rfc822.h
911rfc822.o: mail.h misc.h osdep.h rfc822.h
912tenex.o: mail.h misc.h osdep.h dummy.h
913unix.o: mail.h misc.h osdep.h unix.h pseudo.h dummy.h
914utf8.o: mail.h misc.h osdep.h utf8.h tmap.c widths.c
915utf8aux.o: mail.h misc.h osdep.h utf8.h
916
917
918# OS-dependent
919
920OSDEPS= mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \
921	osdep.h env_unix.h tcp_unix.h \
922	osdep.c env_unix.c fs_unix.c ftl_unix.c nl_unix.c tcp_unix.c ip_unix.c\
923	auths.c crexcl.c flockcyg.c flocklnx.c flocksim.c fsync.c \
924	gethstid.c getspnam.c \
925	gr_wait.c gr_wait4.c gr_waitp.c \
926	kerb_mit.c \
927	auth_ext.c auth_gss.c auth_log.c auth_md5.c auth_pla.c \
928	pmatch.c scandir.c setpgrp.c strerror.c truncate.c write.c \
929	memmove.c memmove2.c memset.c \
930	tz_bsd.c tz_nul.c tz_sv4.c \
931	write.c sslstdio.c \
932	strerror.c strpbrk.c strstr.c strtok.c strtoul.c \
933	OSCFLAGS
934
935osdep.o: $(OSDEPS)
936	$(CC) `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` -c osdep.c
937	@echo ========================================================================
938	@echo Building OS-dependent module
939	@echo If you get No such file error messages for files x509.h, ssl.h,
940	@echo pem.h, buffer.h, bio.h, and crypto.h, that means that OpenSSL
941	@echo is not installed on your system.  Either install OpenSSL first
942	@echo or build with command: make `$(CAT) OSTYPE` SSLTYPE=none
943	@echo ========================================================================
944
945osdep.so: $(OSDEPS)
946	$(CC) -fPIC -DPIC -c `$(CAT) CFLAGS` `$(CAT) OSCFLAGS` osdep.c -o $@
947
948osdep.c: osdepbas.c osdepckp.c osdeplog.c osdepssl.c
949	$(CAT) osdepbas.c osdepckp.c osdeplog.c osdepssl.c > osdep.c
950
951osdepbas.c:
952	@echo osdepbas.c not found...try make clean and new make
953	@false
954
955osdepckp.c:
956	@echo osdepckp.c not found...try make clean and new make
957	@false
958
959osdeplog.c:
960	@echo osdeplog.c not found...try make clean and new make
961	@false
962
963osdepssl.c:
964	@echo osdepssl.c not found...try make clean and new make
965	@false
966
967siglocal.c:
968	@echo siglocal.c not found...try make clean and new make
969	@false
970
971crexcl.c:
972	@echo crexcl.c not found...do make clean and new make
973	@false
974
975ip_unix.c:
976	@echo ip_unix.c not found...do make clean and new make
977	@false
978
979os_sol.h:
980	sh -c 'if [ -f /lib/libc.a ]; then (strings /lib/libc.a | grep getpassphrase > /dev/null) && $(LN) os_soln.h os_sol.h || $(LN) os_solo.h os_sol.h ; else $(LN) os_soln.h os_sol.h ; fi'
981
982
983# Once-only environment setup
984
985once:	onceenv ckp$(PASSWDTYPE) ssl$(SSLTYPE) osdep.c
986
987onceenv:
988	@echo Once-only environment setup...
989	echo $(CC) > CCTYPE
990	echo $(BASECFLAGS) '$(EXTRACFLAGS)' -DCHUNKSIZE=$(CHUNKSIZE) > CFLAGS
991	echo -DCREATEPROTO=$(CREATEPROTO) -DEMPTYPROTO=$(EMPTYPROTO) \
992	 -DMD5ENABLE=\"$(MD5PWD)\" -DMAILSPOOL=\"$(MAILSPOOL)\" \
993	 -DANONYMOUSHOME=\"$(MAILSPOOL)/anonymous\" \
994	 -DACTIVEFILE=\"$(ACTIVEFILE)\" -DNEWSSPOOL=\"$(NEWSSPOOL)\" \
995	 -DRSHPATH=\"$(RSHPATH)\" -DLOCKPGM=\"$(LOCKPGM)\" \
996	 -DLOCKPGM1=\"$(LOCKPGM1)\" -DLOCKPGM2=\"$(LOCKPGM2)\" \
997	 -DLOCKPGM3=\"$(LOCKPGM3)\" > OSCFLAGS
998	echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
999	echo "$(ARRC) $(ARCHIVE) $(BINARIES);$(RANLIB) $(ARCHIVE)" > ARCHIVE
1000	echo $(OS) > OSTYPE
1001	./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy
1002	./mkauths $(EXTRAAUTHENTICATORS) $(DEFAULTAUTHENTICATORS)
1003	echo "  mail_versioncheck (CCLIENTVERSION);" >> linkage.c
1004	$(LN) os_$(OS).h osdep.h
1005	$(LN) os_$(OS).c osdepbas.c
1006	$(LN) log_$(LOGINPW).c osdeplog.c
1007	$(LN) sig_$(SIGTYPE).c siglocal.c
1008	$(LN) crx_$(CRXTYPE).c crexcl.c
1009	$(LN) ip$(IP)_unix.c ip_unix.c
1010	sh -c '(test $(OS) = sc5 -o $(OS) = sco -o ! -f /usr/include/sys/statvfs.h) && echo -DNOFSTATVFS >> OSCFLAGS || fgrep statvfs64 /usr/include/sys/statvfs.h > /dev/null || echo -DNOFSTATVFS64 >> OSCFLAGS'
1011
1012
1013# Password checkers
1014
1015ckpafs:	# AFS
1016	@echo AFS password authentication
1017	echo $(AFSCFLAGS) >> OSCFLAGS
1018#	echo $(AFSLDFLAGS) >> LDFLAGS
1019# Note: Steve Roseman says that AFS libraries have to be lunk before SSL
1020	echo $(AFSLDFLAGS) `$(CAT) LDFLAGS` > LDFLAGS.tmp
1021	mv LDFLAGS.tmp LDFLAGS
1022	$(LN) ckp_afs.c osdepckp.c
1023
1024ckpdce:	# DCE
1025	@echo DCE password authentication
1026	echo $(DCECFLAGS) >> OSCFLAGS
1027	echo $(DCELDFLAGS) >> LDFLAGS
1028	$(LN) ckp_dce.c osdepckp.c
1029
1030ckpgss:	# Kerberos V (must have gss EXTRAAUTHENTICATOR as well)
1031	@echo Kerberos V password authentication
1032	$(LN) ckp_gss.c osdepckp.c
1033
1034ckpnul:	# NUL authenticator (disables all plaintext authentication)
1035	@echo Plaintext authentication prohibited
1036	echo "  mail_parameters (NIL,SET_DISABLEPLAINTEXT,(void *) 1);" >> linkage.c
1037	$(LN) ckp_nul.c osdepckp.c
1038
1039ckppam:	# Pluggable Authentication Modules authenticator
1040	@echo PAM password authentication
1041	echo $(PAMLDFLAGS) >> LDFLAGS
1042	$(LN) ckp_pam.c osdepckp.c
1043
1044ckppmb:	# Broken (e.g. SUN) Pluggable Authentication Modules authenticator
1045	@echo Broken PAM password authentication
1046	echo $(PAMLDFLAGS) >> LDFLAGS
1047	$(LN) ckp_pmb.c osdepckp.c
1048
1049ckpstd:	# Port standard
1050	@echo Standard password authentication
1051	$(LN) ckp_$(CHECKPW).c osdepckp.c
1052
1053ckptwo:	# Something plus standard
1054	@echo $(CHECKPWALT) password authentication first, then standard
1055	$(CAT) ckp_1st.c ckp_$(CHECKPWALT).c ckp_2nd.c ckp_$(CHECKPW).c \
1056	 ckp_3rd.c > osdepckp.c
1057
1058
1059# SSL support
1060
1061sslnone:# No SSL
1062	@echo Building without SSL support
1063	$(LN) ssl_none.c osdepssl.c
1064
1065sslnopwd: sslunix snopwd
1066
1067sslunix.nopwd: sslnopwd
1068
1069sslsco.nopwd: sslsco snopwd
1070
1071sslunix: sbasic sldunix
1072
1073sslsco:	sbasic sldsco
1074
1075sbasic:	# UNIX OpenSSL
1076	@echo Building with SSL
1077	$(LN) ssl_unix.c osdepssl.c
1078	echo $(SSLCFLAGS) >> OSCFLAGS
1079	echo "  ssl_onceonlyinit ();" >> linkage.c
1080
1081snopwd:	# Plaintext disable
1082	@echo Building with SSL and plaintext passwords disabled unless SSL/TLS
1083	echo "  mail_parameters (NIL,SET_DISABLEPLAINTEXT,(void *) 2);" >> linkage.c
1084
1085sldunix:# Normal UNIX SSL load flags
1086	echo $(SSLLDFLAGS) >> LDFLAGS
1087
1088
1089sldsco:	# SCO SSL load flags
1090# Note: Tim Rice says that SSL has to be lunk before other libraries on SCO.
1091	echo $(SSLLDFLAGS) `cat LDFLAGS` > LDFLAGS.tmp
1092	mv LDFLAGS.tmp LDFLAGS
1093
1094
1095# A monument to a hack of long ago and far away...
1096
1097love:
1098	@echo not war?
1099