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