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.1 (Berkeley) 12/28/94
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
94NROFF=	nroff -h
95
96aliases.0: aliases.5
97	${NROFF} -mandoc aliases.5 > aliases.0
98
99mailq.0: mailq.1
100	${NROFF} -mandoc mailq.1 > mailq.0
101
102newaliases.0: newaliases.1
103	${NROFF} -mandoc newaliases.1 > newaliases.0
104
105sendmail.0: sendmail.8
106	${NROFF} -mandoc sendmail.8 > sendmail.0
107
108# new target to save original sendmail files before installation
109save-orig:
110	if [ -f ${BINDIR}/sendmail.orig ]; then \
111		echo "Error: original already saved" 1>&2; \
112		exit 1; \
113	else \
114		/bin/mv ${BINDIR}/sendmail ${BINDIR}/sendmail.orig; \
115		for i in ${LINKS}; do \
116			if [ -h $$i ]; then \
117				/bin/mv $$i $$i.orig; \
118			fi; \
119		done; \
120		if [ -f ${STDIR}/sendmail.st ]; then \
121			/bin/mv ${STDIR}/sendmail.st ${STDIR}/sendmail.st.orig; \
122		fi; \
123		if [ -f ${HFDIR}/sendmail.hf ]; then \
124			/bin/mv ${HFDIR}/sendmail.hf ${HFDIR}/sendmail.hf.orig; \
125		fi; \
126		echo "Now run 'make install'." 1>&2; \
127		echo "(To back out, run 'make backout'.)" 1>&2; \
128	fi
129
130# new target to back out, ie, put back original files
131backout:
132	if [ ! -f ${BINDIR}/sendmail.orig ]; then \
133		echo "Error: original was not saved" 1>&2; \
134		exit 1; \
135	else \
136		/bin/mv ${BINDIR}/sendmail.orig ${BINDIR}/sendmail; \
137		for i in ${LINKS}; do \
138			if [ -h $$i.orig ]; then \
139				/bin/mv $$i.orig $$i; \
140			else \
141				rm -f $$i; \
142			fi; \
143		done; \
144		if [ -f ${STDIR}/sendmail.st.orig ]; then \
145			/bin/mv ${STDIR}/sendmail.st.orig ${STDIR}/sendmail.st; \
146		else \
147			rm -f ${STDIR}/sendmail.st; \
148		fi; \
149		if [ -f ${HFDIR}/sendmail.hf.orig ]; then \
150			/bin/mv ${HFDIR}/sendmail.hf.orig ${HFDIR}/sendmail.hf; \
151		else \
152			rm -f ${HFDIR}/sendmail.hf; \
153		fi; \
154		echo "Now back out config file change if necessary." 1>&2; \
155	fi
156
157#install: install-sendmail install-docs
158install: install-sendmail
159
160install-sendmail: sendmail
161	if [ ! -f ${BINDIR}/sendmail.orig ]; then \
162		echo "Error: Original not saved yet \
163			(no ${BINDIR}/sendmail.orig)" 1>&2; \
164		exit 1; \
165	else \
166		cpset -o sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP}; \
167		for i in ${LINKS}; do \
168			rm -f $$i; \
169			ln ${BINDIR}/sendmail $$i; \
170		done; \
171		cpset -o /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP}; \
172		cpset -o sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP}; \
173		echo "Now install the new config file: \
174			go to ../../cf/cf and run ./Install-dcd-config" 1>&2; \
175	fi
176
177# doesn't actually install them -- you may want to install pre-nroff versions
178install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0
179
180clean:
181	rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
182
183# dependencies
184#   gross overkill, and yet still not quite enough....
185${OBJS}: sendmail.h conf.h
186