1# ========================================================================
2# Copyright 2008-2011 Mark Crispin
3# ========================================================================
4#
5
6# Program:	IMAP Toolkit Makefile
7#
8# Author:	Mark Crispin
9#
10# Date:		7 December 1989
11# Last Edited:	15 April 2013 (jonabbey@arlut.utexas.edu)
12#
13# Previous versions of this file were
14#
15# Copyright 1988-2008 University of Washington
16#
17# Licensed under the Apache License, Version 2.0 (the "License");
18# you may not use this file except in compliance with the License.
19# You may obtain a copy of the License at
20#
21#     http://www.apache.org/licenses/LICENSE-2.0
22
23
24# Normal command to build IMAP toolkit:
25#  make <port> [EXTRAAUTHENTICATORS=xxx] [EXTRADRIVERS=xxx] [EXTRACFLAGS=xxx]
26#	       [PASSWDTYPE=xxx] [SSLTYPE=xxx] [IP=n]
27
28
29# Port name.  These refer to the *standard* compiler on the given system.
30# This means, for example, that the hpx port is for HP's compiler and not for
31# a non-standard compiler such as gcc.
32#
33# If you are using gcc and it is not the standard compiler on your system, try
34# using an ANSI port that is close to what you have.  For example, if your
35# system is SVR4ish, try a32 or lnx; if it's more BSDish, try nxt, mct, or bsi.
36#
37# The following ports are bundled:
38# a32	AIX 3.2 for RS/6000
39# a41	AIX 4.1 for RS/6000
40# a52	AIX 5.2
41# aix	AIX/370 (not RS/6000!!)
42# ami	AmigaDOS
43# am2	AmigaDOS with a 68020+
44# ama	AmigaDOS using AS225R2
45# amn	AmigaDOS with a 680x0 using "new" socket library
46# aos	AOS for RT
47# art	AIX 2.2.1 for RT
48# asv	Altos SVR4
49# aux	A/UX
50# bs3	BSD/i386 3.0 and higher
51# bsd	generic BSD 4.3 (as in ancient 1980s version)
52# bsf	FreeBSD
53# bsi	BSD/i386
54# bso	OpenBSD (yes, yet another one...)
55# cvx	Convex
56# cyg	Cygwin
57# d-g	Data General DG/UX prior to 5.4 (d41 port no longer exists)
58# d54	Data General DG/UX 5.4
59# do4	Apollo Domain/OS sr10.4
60# dpx	Bull DPX/2 B.O.S.
61# drs	ICL DRS/NX
62# dyn	Dynix
63# epx	EP/IX
64# ga4	GCC AIX 4.x for RS/6000
65# gas	GCC Altos SVR4
66# gcs	GCC Solaris with Blastwave Community Open Source Software
67# gh9   GCC HP-UX 9.x
68# ghp	GCC HP-UX 10.x
69# ghs	GCC HP-UX 10.x with Trusted Computer Base
70# go5	GCC 2.7.1 (95q4 from Skunkware _not_ 98q2!) SCO Open Server 5.0.x
71# gsc	GCC Santa Cruz Operation
72# gsg	GCC SGI
73# gso	GCC Solaris
74# gsu	GCC SUN-OS
75# gul	GCC RISC Ultrix (DEC-5000)
76# h11	HP-UX 11i
77# hpp	HP-UX 9.x (see gh9)
78# hpx	HP-UX 10.x (see ghp, ghs, hxd, and shp)
79# hxd	HP-UX 10.x with DCE security (see shp)
80# isc	Interactive Systems
81# ldb	Debian Linux
82# lfd	Fedora Linux
83# ln8	Linux for Nokia N800
84# lnx	Linux with traditional passwords and crypt() in the C library
85#	 (see lnp, sl4, sl5, and slx)
86# lnp	Linux with Pluggable Authentication Modules (PAM)
87# lmd	Mandrake Linux
88# lr5	RedHat Enterprise Linux 5 and later (same as lfd)
89# lrh	RedHat Linux 7.2 and later
90# lsu	SuSE Linux (same as lrh)
91# lyn	LynxOS
92# mct	MachTen
93# mnt	Atari ST Mint (not MacMint)
94# neb	NetBSD
95# nec	NEC UX
96# nto	QNX Neutrino RTP
97# nxt	NEXTSTEP
98# nx3	NEXTSTEP 3.x
99# osf	OSF/1 (see sos, os4)
100# os4	OSF/1 (Digital UNIX) 4
101# osi	Apple iPhone and iPod Touch
102# osx	Mac OS X
103# oxp	Mac OS X with Pluggable Authentication Modules (PAM)
104# oxs	Mac OS X Snow Leopard
105# ptx	PTX
106# pyr	Pyramid
107# qnx	QNX 4
108# qn6	QNX 6
109# s40	SUN-OS 4.0 (*not* Solaris)
110# sc5	SCO Open Server 5.0.x (see go5)
111# sco	Santa Cruz Operation (see sc5, go5)
112# shp	HP-UX with Trusted Computer Base
113# sgi	Silicon Graphics IRIX
114# sg6	Silicon Graphics IRIX 6.5
115# sl4	Linux using -lshadow to get the crypt() function
116# sl5	Linux with shadow passwords, no extra libraries
117# slx	Linux using -lcrypt to get the crypt() function
118# snx	Siemens Nixdorf SININX or Reliant UNIX
119# soc	Solaris with /opt/SUNWspro/bin/cc
120# sol	Solaris (won't work unless "ucbcc" works -- use gso instead)
121# sos	OSF/1 with SecureWare
122# ssn	SUN-OS with shadow password security
123# sua	Windows Vista (Enterprise or Ultima) Subsystem for Unix Applications
124# sun	SUN-OS 4.1 or better (*not* Solaris) (see ssn)
125# sv2	SVR2 on AT&T PC-7300 (incomplete port)
126# sv4	generic SVR4
127# ult	RISC Ultrix (DEC-5000)
128# uw2	UnixWare SVR4.2
129# vul	VAX Ultrix
130# vu2	VAX Ultrix 2.3 (e.g. for VAXstation-2000 or similar old version)
131
132
133# Extra authenticators (e.g. OTP, Kerberos, etc.).  Adds linkage for
134# auth_xxx.c and executes Makefile.xxx, where xxx is the name of the
135# authenticator.  Some authenticators are only available from third parties.
136#
137# The following extra authenticators are bundled:
138# gss	Kerberos V
139
140EXTRAAUTHENTICATORS=
141
142
143# Additional mailbox drivers.  Add linkage for xxxdriver.  Some drivers are
144# only available from third parties.
145#
146# The following extra drivers are bundled:
147# mbox	if file "mbox" exists on the home directory, automatically moves mail
148#	 from the spool directory to "mbox" and uses "mbox" as INBOX.
149
150EXTRADRIVERS=mbox
151
152
153# Plaintext password type.  Defines how plaintext password authentication is
154# done on this system.
155#
156# The following plaintext login types are bundled:
157# afs	AFS authentication database
158# dce	DCE authentication database
159# gss	Kerberos V
160# nul	plaintext authentication never permitted
161# pam	PAM authentication (note: for Linux, you should use the "lnp" port
162#	 instead of setting this...also, you may have to modify PAMLDFLAGS
163#	 in the imap-[]/src/osdep/unix/Makefile
164# pmb	PAM authentication for broken implementations such as Solaris.
165#	 you may have to modify PAMLDFLAGS
166# std	system standard (typically passwd file), determined by port
167# two	try alternative (defined by CHECKPWALT), then std
168
169PASSWDTYPE=std
170
171
172# SSL type.  Defines whether or not SSL support is on this system
173#
174# The following SSL types are bundled:
175# none	no SSL support
176# unix	SSL support using OpenSSL
177# nopwd	SSL support using OpenSSL, and plaintext authentication permitted only
178#	in SSL/TLS sessions
179# sco	link SSL before other libraries (for SCO systems)
180# unix.nopwd	same as nopwd
181# sco.nopwd	same as nopwd, plaintext authentication in SSL/TLS only
182#
183# SSLTYPE=nopwd is now the default as required by RFC 3501
184
185SSLTYPE=nopwd
186
187
188# IP protocol version
189#
190# The following IP protocol versions are defined:
191# 4	(default) IPv4 support only
192# 6	IPv6 and IPv4 support
193
194IP=4
195IP6=6
196
197
198# The following extra compilation flags are defined.  None of these flags are
199# recommended.  If you use these, include them in the EXTRACFLAGS.
200#
201# -DDISABLE_POP_PROXY
202#	By default, the ipop[23]d servers offer POP->IMAP proxy access,
203#	which allow a POP client to access mail on an IMAP server by using the
204#	POP server as a go-between.  Setting this option disables this
205#	facility.
206#
207# -DOLDFILESUFFIX=\"xxx\"
208#	Change the default suffix appended to the backup .newsrc file from
209#	"old".
210#
211# -DSTRICT_RFC822_TIMEZONES
212#	Disable recognition of the non-standard UTC (0000), MET (+0100),
213#	EET (+0200), JST (+0900), ADT (-0300), AST (-0400), YDT (-0800),
214#	YST (-0900), and HST (-1000) symbolic timezones.
215#
216# -DBRITISH_SUMMER_TIME
217#	Enables recognition of non-standard symbolic timezone BST as +0100.
218#
219# -DBERING_STANDARD_TIME
220#	Enables recognition of non-standard symbolic timezone BST as -1100.
221#
222# -DNEWFOUNDLAND_STANDARD_TIME
223#	Enables recognition of non-standard symbolic timezone NST as -0330.
224#
225# -DNOME_STANDARD_TIME
226#	Enables recognition of non-standard symbolic timezone NST as -1100.
227#
228# -DSAMOA_STANDARD_TIME
229#	Enables recognition of non-standard symbolic timezone SST as -1100.
230#
231# -DY4KBUGFIX
232#	Turn on the Y4K bugfix (yes, that's year 4000).  It isn't well-known,
233#	but century years evenly divisible by 4000 are *not* leap years in the
234#	Gregorian calendar.  A lot of "Y2K compilant" software does not know
235#	about this rule.  Remember to turn this on sometime in the next 2000
236#	years.
237#
238# -DUSEORTHODOXCALENDAR
239#	Use the more accurate Eastern Orthodox calendar instead of the
240#	Gregorian calendar.  The century years which are leap years happen
241#	at alternating 400 and 500 year intervals without shifts every 4000
242#	years.  The Orthodox and Gregorian calendars diverge by 1 day for
243#	gradually-increasing intervals, starting at 2800-2900, and becoming
244#	permanent at 48,300.
245#
246# -DUSEJULIANCALENDAR
247#	Use the less accurate Julian calendar instead of the Gregorian
248#	calendar.  Leap years are every 4 years, including century years.
249#	My apologies to those in the English-speaking world who object to
250#	the reform of September 2, 1752 -> September 14, 1752, since this
251#	code still uses January 1 (which Julius Ceasar decreed as the start
252#	of the year, which since 153 BCE was the day that Roman consuls
253#	took office), rather than the traditional March 25 used by the
254#	British.  As of 2005, the Julian calendar and the Gregorian calendar
255#	diverge by 15 days.
256
257EXTRACFLAGS=
258
259
260# Extra linker flags (additional/alternative libraries, etc.)
261
262EXTRALDFLAGS=
263
264
265# Special make flags (e.g. to override make environment variables)
266
267EXTRASPECIALS=
268SPECIALS=
269
270
271# Normal commands
272
273CAT=cat
274CD=cd
275LN=ln -s
276MAKE=make
277MKDIR=mkdir
278BUILDTYPE=rebuild
279RM=rm -rf
280SH=sh
281SYSTEM=unix
282TOOLS=tools
283TOUCH=touch
284
285
286# Primary build command
287
288BUILD=$(MAKE) build EXTRACFLAGS='$(EXTRACFLAGS)'\
289 EXTRALDFLAGS='$(EXTRALDFLAGS)'\
290 EXTRADRIVERS='$(EXTRADRIVERS)'\
291 EXTRAAUTHENTICATORS='$(EXTRAAUTHENTICATORS)'\
292 PASSWDTYPE=$(PASSWDTYPE) SSLTYPE=$(SSLTYPE) IP=$(IP)\
293 EXTRASPECIALS='$(EXTRASPECIALS)'
294
295
296# Make the IMAP Toolkit
297
298all:	c-client SPECIALS rebuild
299
300c-client:
301	@echo Not processed yet.  In a first-time build, you must specify
302	@echo the system type so that the sources are properly processed.
303	@false
304
305
306SPECIALS:
307	echo $(SPECIALS) > SPECIALS
308
309# Note on SCO you may have to set LN to "ln".
310
311a32 a41 a52 aix bs3 bsi d-g d54 do4 drs epx ga4 gas gh9 ghp ghs go5 gsc gsg gso gul h11 hpp hpx lnp lyn mct mnt nec nto nxt nx3 osf os4 ptx qnx qn6 sc5 sco sgi sg6 shp sl4 sl5 slx snx soc sol sos uw2: an
312	$(BUILD) BUILDTYPE=$@
313
314# If you use sv4, you may find that it works to move it to use the an process.
315# If so, you probably will want to delete the "-Dconst=" from the sv4 CFLAGS in
316# the c-client Makefile.
317
318aos art asv aux bsd cvx dpx dyn isc pyr sv4 ult vul vu2: ua
319	$(BUILD) BUILDTYPE=$@
320
321
322# Knotheads moved Kerberos and SSL locations on these platforms
323
324# Paul Vixie claims that all FreeBSD versions have working IPv6
325
326bsf:	an
327	$(TOUCH) ip6
328	$(BUILD) BUILDTYPE=$@ IP=$(IP6) \
329	PASSWDTYPE=pam \
330	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMLDFLAGS=-lpam"
331
332# I assume that Theo did the right thing for IPv6.  OpenBSD does not have PAM.
333
334bso:	an
335	$(TOUCH) ip6
336	$(BUILD) BUILDTYPE=$@ IP=$(IP6) \
337	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/etc/ssl SSLKEYS=/etc/ssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib"
338
339# Info from Joel Reicher about NetBSD SSL paths.  I assume it has PAM because pam is in NetBSD sources...
340
341neb:	an
342	$(TOUCH) ip6
343	$(BUILD) BUILDTYPE=$@ IP=$(IP6) \
344	PASSWDTYPE=pam \
345	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/etc/openssl/certs SSLKEYS=/etc/openssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMLDFLAGS=-lpam"
346
347cyg:	an
348	$(BUILD) BUILDTYPE=cyg \
349	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/usr/ssl/certs SSLKEYS=/usr/ssl/certs"
350
351gcs:	an
352	$(BUILD) BUILDTYPE=gso \
353	SPECIALS="SSLINCLUDE=/opt/csw/include/openssl SSLLIB=/opt/csw/lib SSLCERTS=/opt/csw/ssl/certs SSLKEYS=/opt/csw/ssl/certs"
354
355ldb:	an
356	$(BUILD) BUILDTYPE=lnp IP=$(IP6) \
357	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib MAILSPOOL=/var/mail"
358
359lfd:	an
360	$(BUILD) BUILDTYPE=lnp IP=$(IP6) \
361	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/etc/pki/tls/certs SSLKEYS=/etc/pki/tls/private GSSDIR=/usr/kerberos"
362
363ln8:	an
364	$(TOUCH) ip6
365	$(BUILD) BUILDTYPE=slx IP=$(IP6) \
366	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/usr/lib/ssl/certs MAILSPOOL=/var/mail"
367
368
369# RHEL5/6 does not have the IPv6 bug
370
371lr5:	an
372	$(TOUCH) ip6
373	$(BUILD) BUILDTYPE=lnp IP=$(IP6) \
374	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/etc/pki/tls/certs SSLKEYS=/etc/pki/tls/private GSSDIR=/usr/kerberos"
375
376lmd:	an
377	$(BUILD) BUILDTYPE=lnp IP=$(IP6) \
378	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/usr/lib/ssl/certs SSLKEYS=/usr/lib/ssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib"
379
380# RHEL3 definitely has the IPv6 bug
381
382lrh:	lrhok an
383	$(BUILD) BUILDTYPE=lnp IP=$(IP6) \
384	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/usr/share/ssl/certs SSLKEYS=/usr/share/ssl/private GSSDIR=/usr/kerberos"
385
386lrhok:
387	@$(SH) -c '(test ! -d /etc/pki/tls ) || make lrhwarn'
388	@$(TOUCH) lrhok
389
390lrhwarn:
391	@echo You are building for OLD versions of RedHat Linux.  This build
392	@echo is NOT suitable for RedHat Enterprise 5 / 6, which store SSL/TLS
393	@echo certificates and keys in /etc/pki/tls rather than /usr/share/ssl.
394	@echo If you want to build for modern RedHat Linux, you should use
395	@echo make lr5 instead.
396	@echo Do you want to continue this build?  Type y or n please:
397	@$(SH) -c 'read x; case "$$x" in y) exit 0;; *) exit 1;; esac'
398	@echo OK, I will remember that you really want to build for old
399	@echo RedHat Linux.  You will not see this message again.
400	@echo If you realize that you really wanted to build for modern
401	@echo RedHat Linux, then do the following commands:
402	@echo % rm lrhok
403	@echo % make clean
404	@echo % make lr5
405
406lsu:	an
407	$(BUILD) BUILDTYPE=lnp IP=$(IP6) \
408	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/usr/share/ssl/certs SSLKEYS=/usr/share/ssl/private GSSDIR=/usr/kerberos"
409
410# iToy does not have Kerberos or PAM.  It doesn't have a
411# /System/Library/OpenSSL directory either, but the libcrypto shared library
412# has these locations so this is what we will use.
413
414osi:	an
415	$(TOUCH) ip6
416	$(BUILD) BUILDTYPE=osx IP=$(IP6) CC=arm-apple-darwin-gcc \
417	EXTRACFLAGS="$(EXTRACFLAGS) -DMAC_OSX_KLUDGE=1 -Dhash_create=Hash_create -Dhash_destroy=Hash_destroy -Dlogout=Logout" \
418	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/System/Library/OpenSSL/certs SSLKEYS=/System/Library/OpenSSL/private"
419
420oxp:	an
421	$(TOUCH) ip6
422	$(BUILD) BUILDTYPE=osx IP=$(IP6) EXTRAAUTHENTICATORS="$(EXTRAAUTHENTICATORS) gss" \
423	PASSWDTYPE=pam \
424	EXTRACFLAGS="$(EXTRACFLAGS) -DMAC_OSX_KLUDGE=1" \
425	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/System/Library/OpenSSL/certs SSLKEYS=/System/Library/OpenSSL/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMDLFLAGS=-lpam"
426
427oxs:	an
428	$(TOUCH) ip6
429	$(BUILD) BUILDTYPE=osx IP=$(IP6) EXTRAAUTHENTICATORS="$(EXTRAAUTHENTICATORS) gss" \
430	PASSWDTYPE=pam \
431	EXTRACFLAGS="$(EXTRACFLAGS)" \
432	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/System/Library/OpenSSL/certs SSLKEYS=/System/Library/OpenSSL/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMDLFLAGS=-lpam"
433
434osx:	osxok an
435	$(TOUCH) ip6
436	$(BUILD) BUILDTYPE=$@ IP=$(IP6) EXTRAAUTHENTICATORS="$(EXTRAAUTHENTICATORS) gss" \
437	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/System/Library/OpenSSL/certs SSLKEYS=/System/Library/OpenSSL/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib"
438
439osxok:
440	@$(SH) -c '(test ! -f /usr/include/pam/pam_appl.h ) || make osxwarn'
441	@$(TOUCH) osxok
442
443osxwarn:
444	@echo You are building for OLD versions of Mac OS X.  This build is
445	@echo NOT suitable for modern versions of Mac OS X, such as Tiger,
446	@echo which use PAM-based authentication.  If you want to build for
447	@echo modern Mac OS X, you should use make oxp instead.
448	@echo Do you want to continue this build?  Type y or n please:
449	@$(SH) -c 'read x; case "$$x" in y) exit 0;; *) exit 1;; esac'
450	@echo OK, I will remember that you really want to build for old
451	@echo Mac OS X.  You will not see this message again.
452	@echo If you realize that you really wanted to build for modern
453	@echo Mac OS X, then do the following commands:
454	@echo % rm osxok
455	@echo % make clean
456	@echo % make oxp
457
458
459# Linux shadow password support doesn't build on traditional systems, but most
460# Linux systems are shadow these days.
461
462lnx:	lnxnul an
463	$(BUILD) BUILDTYPE=$@
464
465lnxnul:
466	@$(SH) -c '(test $(PASSWDTYPE) = nul) || make lnxok'
467
468lnxok:
469	@echo You are building for traditional Linux.  Most modern Linux
470	@echo systems require that you build using make slx.
471	@echo Do you want to continue this build?  Type y or n please:
472	@$(SH) -c 'read x; case "$$x" in y) exit 0;; *) exit 1;; esac'
473	@echo OK, I will remember that you really want to build for
474	@echo traditional Linux.  You will not see this message again.
475	@echo If you discover that you can not log in to the POP and IMAP
476	@echo servers, then do the following commands:
477	@echo % rm lnxok
478	@echo % make clean
479	@echo % make slx
480	@echo If slx does not work, try sl4 or sl5.  Be sure to do a
481	@echo make clean between each try!
482	@$(TOUCH) lnxok
483
484
485# SUN-OS C compiler makes you load libdl by hand...
486
487ssn sun: sunok suntools ua
488	$(BUILD) BUILDTYPE=$@
489
490suntools:
491	$(CD) tools;$(MAKE) LDFLAGS=-ldl
492
493gsu:	sunok an
494	$(BUILD) BUILDTYPE=$@
495
496s40:	sunok ua
497	$(BUILD) BUILDTYPE=$@
498
499sunok:
500	@echo You are building for the old BSD-based SUN-OS.  This is NOT
501	@echo the modern SVR4-based Solaris.  If you want to build for
502	@echo Solaris, you should use make gso or make sol or make soc.  Do
503	@echo you want to continue this build?  Type y or n please:
504	@$(SH) -c 'read x; case "$$x" in y) exit 0;; *) exit 1;; esac'
505	@echo OK, I will remember that you really want to build for the old
506	@echo BSD-based SUN-OS.  You will not see this message again.
507	@echo If the build fails and you realize that you really wanted to
508	@echo build for Solaris, then do the following commands:
509	@echo % rm sunok
510	@echo % make clean
511	@echo % make gso
512	@echo If gso does not work, try sol.  Be sure to do a make clean
513	@echo between each try!
514	@$(TOUCH) sunok
515
516
517# SVR2 doesn't have symbolic links (at least my SVR2 system doesn't)
518
519sv2:
520	$(MAKE) ua LN=ln
521	$(BUILD) BUILDTYPE=$@ LN=ln
522
523# Hard links don't quite work right in SUA, and there don't seem to be any
524# SSL includes.  However, IPv6 works.
525
526sua:
527	$(TOUCH) ip6 sslnone
528	$(MAKE) an LN=cp SSLTYPE=none
529	$(BUILD) BUILDTYPE=$@ LN=cp IP=$(IP6) SSLTYPE=none
530
531
532# Pine port names, not distinguished in c-client
533
534bs2:	an
535	$(BUILD) BUILDTYPE=bsi
536
537pt1:	an
538	$(BUILD) BUILDTYPE=ptx
539
540
541# Compatibility
542
543hxd:
544	$(BUILD) BUILDTYPE=hpx PASSWDTYPE=dce
545
546# Amiga
547
548ami am2 ama amn:
549	$(MAKE) an LN=cp SYSTEM=amiga
550	$(BUILD) BUILDTYPE=$@ LN=cp
551
552
553# Courtesy entries for Microsoft systems
554
555nt:
556	nmake /nologo /f makefile.nt
557
558ntk:
559	nmake /nologo /f makefile.ntk
560
561w2k:
562	nmake /nologo /f makefile.w2k
563
564wce:
565	nmake /nologo /f makefile.wce
566
567
568# SSL build choices
569
570sslnopwd sslunix.nopwd sslsco.nopwd:
571	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
572	@echo + Building in full compliance with RFC 3501 security
573	@echo + requirements:
574	@echo ++ TLS/SSL encryption is supported
575	@echo ++ Unencrypted plaintext passwords are prohibited
576	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
577
578sslunix sslsco:
579	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
580	@echo + Building in PARTIAL compliance with RFC 3501 security
581	@echo + requirements:
582	@echo + Compliant:
583	@echo ++ TLS/SSL encryption is supported
584	@echo + Non-compliant:
585	@echo ++ Unencrypted plaintext passwords are permitted
586	@echo +
587	@echo + In order to rectify this problem, you MUST build with:
588	@echo ++ SSLTYPE=$(SSLTYPE).nopwd
589	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
590
591nounenc:
592	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
593	@echo + At your request, this build with unencrypted authentication has
594	@echo + been CANCELLED.
595	@echo + You must start over with a new make command.
596	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
597
598
599sslnone:
600	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
601	@echo + Building in NON-COMPLIANCE with RFC 3501 security requirements:
602	@echo + Non-compliant:
603	@echo ++ TLS/SSL encryption is NOT supported
604	@echo ++ Unencrypted plaintext passwords are permitted
605	@echo +
606	@echo + In order to rectify this problem, you MUST build with:
607	@echo ++ SSLTYPE=nopwd
608	@echo + You must also have OpenSSL or equivalent installed.
609	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
610
611nonossl:
612	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
613	@echo + At your request, this build with no TLS/SSL support has been
614	@echo + CANCELLED.
615	@echo + You must start over with a new make command.
616	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
617
618
619# IP build choices
620
621ip4:
622	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
623	@echo + Building with IPv4 support
624	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
625
626ip6:
627	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
628	@echo + Building with IPv6 support
629	@echo +
630	@echo + NOTE: Some versions of glibc have a bug in the getaddrinfo
631	@echo + call which does DNS name resolution.  This bug causes host
632	@echo + names to be canonicalized incorrectly, as well as doing an
633	@echo + unnecessary and performance-sapping reverse DNS call.  This
634	@echo + problem does not affect the IPv4 gethostbyname call.
635	@echo +
636	@echo + getaddrinfo works properly on Mac OS X and Windows.  However,
637	@echo + the problem has been observed on some Linux systems.
638	@echo +
639	@echo + If you answer n to the following question the build will be
640	@echo + cancelled and you must rebuild.  If you did not specify IPv6
641	@echo + yourself, try adding IP6=4 to the make command line.
642	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
643	@echo
644	@echo Do you want to build with IPv6 anyway?  Type y or n please:
645	@$(SH) -c 'read x; case "$$x" in y) exit 0;; *) (make noip6;exit 1);; esac'
646	@echo OK, I will remember that you really want to build with IPv6.
647	@echo You will not see this message again.
648	@$(TOUCH) ip6
649
650noip6:
651	$(MAKE) clean
652	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
653	@echo + At your request, this build with IPv6 has been CANCELLED.
654	@echo + You must start over with a new make command.
655	@echo +
656	@echo + If you wish to rebuild without IPv6 support, do one of the
657	@echo + following:
658	@echo +
659	@echo + 1. If you specified IP=6 on the make command line, omit it.
660	@echo +
661	@echo + 2. Some of the Linux builds automatically select IPv6.  If
662	@echo + you choose one of those builds, add IP6=4 to the make command
663	@echo + line.  Note that this is IP6=4, not IP=4.
664	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
665
666# C compiler types
667
668an ua:
669	@$(MAKE) ssl$(SSLTYPE)
670	@echo Applying $@ process to sources...
671	$(TOOLS)/$@ "$(LN)" src/c-client c-client
672	$(TOOLS)/$@ "$(LN)" src/ansilib c-client
673	$(TOOLS)/$@ "$(LN)" src/charset c-client
674	$(TOOLS)/$@ "$(LN)" src/osdep/$(SYSTEM) c-client
675	$(TOOLS)/$@ "$(LN)" src/mtest mtest
676	$(TOOLS)/$@ "$(LN)" src/ipopd ipopd
677	$(TOOLS)/$@ "$(LN)" src/imapd imapd
678	$(TOOLS)/$@ "$(LN)" src/mailutil mailutil
679	$(TOOLS)/$@ "$(LN)" src/mlock mlock
680	$(TOOLS)/$@ "$(LN)" src/dmail dmail
681	$(TOOLS)/$@ "$(LN)" src/tmail tmail
682	$(LN) $(TOOLS)/$@ .
683
684build:	OSTYPE rebuild rebuildclean
685
686OSTYPE:
687	@$(MAKE) ip$(IP)
688	@echo Building c-client for $(BUILDTYPE)...
689	@$(TOUCH) SPECIALS
690	echo `$(CAT) SPECIALS` $(EXTRASPECIALS) > c-client/SPECIALS
691	$(CD) c-client;$(MAKE) $(BUILDTYPE) EXTRACFLAGS='$(EXTRACFLAGS)'\
692	 EXTRALDFLAGS='$(EXTRALDFLAGS)'\
693	 EXTRADRIVERS='$(EXTRADRIVERS)'\
694	 EXTRAAUTHENTICATORS='$(EXTRAAUTHENTICATORS)'\
695	 PASSWDTYPE=$(PASSWDTYPE) SSLTYPE=$(SSLTYPE) IP=$(IP)\
696	 $(SPECIALS) $(EXTRASPECIALS)
697	echo $(BUILDTYPE) > OSTYPE
698	$(TOUCH) rebuild
699
700rebuild:
701	@$(SH) -c '(test $(BUILDTYPE) = rebuild -o $(BUILDTYPE) = `$(CAT) OSTYPE`) || (echo Already built for `$(CAT) OSTYPE` -- you must do \"make clean\" first && exit 1)'
702	@echo Rebuilding c-client for `$(CAT) OSTYPE`...
703	@$(TOUCH) SPECIALS
704	$(CD) c-client;$(MAKE) all CFLAGS="`$(CAT) CFLAGS`" `$(CAT) SPECIALS`
705
706rebuildclean:
707	$(SH) -c '$(RM) rebuild || true'
708
709bundled:
710	@echo Building bundled tools...
711	$(CD) mtest;$(MAKE)
712	$(CD) ipopd;$(MAKE)
713	$(CD) imapd;$(MAKE)
714	$(CD) mailutil;$(MAKE)
715	@$(SH) -c '(test -f /usr/include/sysexits.h ) || make sysexitwarn'
716	$(CD) mlock;$(MAKE) || true
717	$(CD) dmail;$(MAKE) || true
718	$(CD) tmail;$(MAKE) || true
719
720
721sysexitwarn:
722	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
723	@echo + Hmm...it does not look like /usr/include/sysexits.h exists.
724	@echo + Either your system is too ancient to have the sysexits.h
725	@echo + include, or your C compiler gets it from some other location
726	@echo + than /usr/include.  If your system is too old to have the
727	@echo + sysexits.h include, you will not be able to build the
728	@echo + following programs.
729	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
730
731clean:
732	@echo Removing old processed sources and binaries...
733	$(SH) -c '$(RM) an ua OSTYPE SPECIALS c-client mtest imapd ipopd mailutil mlock dmail tmail ip6 || true'
734	$(CD) tools;$(MAKE) clean
735
736
737# A monument to a hack of long ago and far away...
738love:
739	@echo not war?
740