1#  This Makefile is designed to work on the old "make" program.  It does
2#  not use the obj subdirectory.  It also does not install documentation
3#  automatically -- think of it as a quick start for sites that have the
4#  old make program (I recommend that you get and port the new make if you
5#  are going to be doing any signficant work on sendmail).
6#
7#  Makefile for an Amdahl 5890 running UTS System V 2.1.5 (SVr3)
8#  By Janet Jackson <janet@dialix.oz.au> 1994-11-24
9#	This has been tested on (uname -a output) uts bsuts systemV 2.1.5 5890
10#
11#	@(#)Makefile.uts.systemV	8.2 (Berkeley) 04/10/95
12#
13
14#  Sendmail 8 on UTS requires BIND 4.9's include files and lib44bsd and
15#  libresolv libraries.  The BIND version on UTS is much too old.
16#
17BINDPATH=../../../bind
18
19# use O=-O (usual) or O=-g (debugging)
20O=	-g
21
22# define the database mechanisms available for map & alias lookups:
23#	-DNDBM -- use new DBM
24#	-DNEWDB -- use new Berkeley DB
25#	-DNIS -- include NIS support
26# The really old (V7) DBM library is no longer supported.
27# See READ_ME for a description of how these flags interact.
28#
29# Getting NIS working on UTS is possible (I did it!) but awkward.
30# And forget it unless you're behind some sort of a firewall.
31#
32DBMDEF=	-DNIS -DNDBM
33
34# environment definitions (e.g., -D_AIX3)
35ENVDEF= -D_UTS
36
37# see also conf.h for additional compilation flags
38
39# include directories
40# To find new BIND header files. This path assumes we are using "makesendmail".
41INCDIRS=-I${BINDPATH}/include -I${BINDPATH}/compat/include
42
43# loader options
44LDOPTS=
45
46# library directories
47# To find new libresolv.a.  This path assumes we are using "makesendmail".
48LIBDIRS=-L${BINDPATH}/res -L${BINDPATH}/compat/lib
49
50# libraries required on your system
51LIBS= -lyp -lrpc -lresolv -l44bsd -lbsd -lsocket -la
52
53# location of sendmail binary (usually /usr/sbin or /usr/lib)
54BINDIR=	${DESTDIR}/usr/lib
55
56# location of sendmail.st file (usually /var/log or /usr/lib)
57STDIR=	${DESTDIR}/usr/lib
58
59# location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
60HFDIR=	${DESTDIR}/usr/lib
61
62# additional .o files needed
63OBJADD=
64
65# things to do before compilation
66BEFORE=	stddef.h
67
68###################  end of user configuration flags  ######################
69
70CFLAGS=	-eft -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
71
72OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
73	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
74	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
75	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
76	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
77
78LINKS=	${DESTDIR}/usr/lib/newaliases ${DESTDIR}/usr/lib/mailq
79BINOWN=	root
80BINGRP=	mail
81BINMODE=6555
82
83#ALL=	sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
84ALL=	sendmail
85
86all: ${ALL}
87
88sendmail: ${BEFORE} ${OBJS}
89	${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
90
91stddef.h:
92	echo "#include <sys/types.h>" > stddef.h
93
94#NROFF=	nroff -h
95NROFF=	groff -Tascii
96MANDOC=	-mandoc
97
98aliases.0: aliases.5
99	${NROFF} ${MANDOC} aliases.5 > aliases.0
100
101mailq.0: mailq.1
102	${NROFF} ${MANDOC} mailq.1 > mailq.0
103
104newaliases.0: newaliases.1
105	${NROFF} ${MANDOC} newaliases.1 > newaliases.0
106
107sendmail.0: sendmail.8
108	${NROFF} ${MANDOC} sendmail.8 > sendmail.0
109
110# new target to save original sendmail files before installation
111save-orig:
112	if [ -f ${BINDIR}/sendmail.orig ]; then \
113		echo "Error: original already saved" 1>&2; \
114		exit 1; \
115	else \
116		/bin/mv ${BINDIR}/sendmail ${BINDIR}/sendmail.orig; \
117		for i in ${LINKS}; do \
118			if [ -h $$i ]; then \
119				/bin/mv $$i $$i.orig; \
120			fi; \
121		done; \
122		if [ -f ${STDIR}/sendmail.st ]; then \
123			/bin/mv ${STDIR}/sendmail.st ${STDIR}/sendmail.st.orig; \
124		fi; \
125		if [ -f ${HFDIR}/sendmail.hf ]; then \
126			/bin/mv ${HFDIR}/sendmail.hf ${HFDIR}/sendmail.hf.orig; \
127		fi; \
128		echo "Now run 'make install'." 1>&2; \
129		echo "(To back out, run 'make backout'.)" 1>&2; \
130	fi
131
132# new target to back out, ie, put back original files
133backout:
134	if [ ! -f ${BINDIR}/sendmail.orig ]; then \
135		echo "Error: original was not saved" 1>&2; \
136		exit 1; \
137	else \
138		/bin/mv ${BINDIR}/sendmail.orig ${BINDIR}/sendmail; \
139		for i in ${LINKS}; do \
140			if [ -h $$i.orig ]; then \
141				/bin/mv $$i.orig $$i; \
142			else \
143				rm -f $$i; \
144			fi; \
145		done; \
146		if [ -f ${STDIR}/sendmail.st.orig ]; then \
147			/bin/mv ${STDIR}/sendmail.st.orig ${STDIR}/sendmail.st; \
148		else \
149			rm -f ${STDIR}/sendmail.st; \
150		fi; \
151		if [ -f ${HFDIR}/sendmail.hf.orig ]; then \
152			/bin/mv ${HFDIR}/sendmail.hf.orig ${HFDIR}/sendmail.hf; \
153		else \
154			rm -f ${HFDIR}/sendmail.hf; \
155		fi; \
156		echo "Now back out config file change if necessary." 1>&2; \
157	fi
158
159#install: install-sendmail install-docs
160install: install-sendmail
161
162install-sendmail: sendmail
163	if [ ! -f ${BINDIR}/sendmail.orig ]; then \
164		echo "Error: Original not saved yet \
165			(no ${BINDIR}/sendmail.orig)" 1>&2; \
166		exit 1; \
167	else \
168		cpset -o sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP}; \
169		for i in ${LINKS}; do \
170			rm -f $$i; \
171			ln ${BINDIR}/sendmail $$i; \
172		done; \
173		cpset -o /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP}; \
174		cpset -o sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP}; \
175		echo "Now install the new config file: \
176			go to ../../cf/cf and run ./Install-dcd-config" 1>&2; \
177	fi
178
179# doesn't actually install them -- you may want to install pre-nroff versions
180install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0
181
182clean:
183	rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
184
185# dependencies
186#   gross overkill, and yet still not quite enough....
187${OBJS}: sendmail.h conf.h
188