17c478bdstevel@tonic-gate#
27c478bdstevel@tonic-gate# CDDL HEADER START
37c478bdstevel@tonic-gate#
47c478bdstevel@tonic-gate# The contents of this file are subject to the terms of the
524da5b3rie# Common Development and Distribution License (the "License").
624da5b3rie# You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate#
87c478bdstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate# See the License for the specific language governing permissions
117c478bdstevel@tonic-gate# and limitations under the License.
127c478bdstevel@tonic-gate#
137c478bdstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate#
197c478bdstevel@tonic-gate# CDDL HEADER END
207c478bdstevel@tonic-gate#
217c478bdstevel@tonic-gate#
2224fe0b3jmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bdstevel@tonic-gate# Use is subject to license terms.
247c478bdstevel@tonic-gate#
255661bb7John Levon# Copyright (c) 2018, Joyent, Inc.
265661bb7John Levon#
277c478bdstevel@tonic-gate
285661bb7John LevonBINPROG=	mail
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gatePROG= 	       $(BINPROG)
317c478bdstevel@tonic-gate
327c478bdstevel@tonic-gateGREP=		grep
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gateinclude ../Makefile.cmd
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gateCLOBBERFILES=	$(PROG)
377c478bdstevel@tonic-gateCLEANFILES=	$(MAILOBJS)
387c478bdstevel@tonic-gate
397c478bdstevel@tonic-gateMAILOBJS= 	add_recip.o cat.o ckdlivopts.o \
407c478bdstevel@tonic-gate		cksaved.o clr_hinfo.o copyback.o copylet.o \
417c478bdstevel@tonic-gate		copymt.o createmf.o del_recipl.o Dout.o  delete.o \
427c478bdstevel@tonic-gate		done.o doopen.o dumpaff.o dumprcv.o \
437c478bdstevel@tonic-gate		errmsg.o gendeliv.o getarg.o getcomment.o \
447c478bdstevel@tonic-gate		gethead.o goback.o init.o \
457c478bdstevel@tonic-gate		isheader.o isit.o islocal.o istext.o legal.o \
467c478bdstevel@tonic-gate		lock.o  main.o mkdead.o mta_ercode.o \
477c478bdstevel@tonic-gate		new_recipl.o parse.o pckaffspot.o pckrcvspot.o \
487c478bdstevel@tonic-gate		pickFrom.o pipletr.o poplist.o printhdr.o printmail.o \
497c478bdstevel@tonic-gate		pushlist.o savehdrs.o sel_disp.o  sendlist.o \
507c478bdstevel@tonic-gate		sendmail.o  setsig.o \
51b7d62afceastha		stamp.o Tout.o
527c478bdstevel@tonic-gate
537c478bdstevel@tonic-gateMAILSRC=	 $(MAILOBJS:%.o=%.c)
547c478bdstevel@tonic-gate
557c478bdstevel@tonic-gateCPROG=		mail
567c478bdstevel@tonic-gateCPROGSRC= 	$(CPROG:%=_%.c)
577c478bdstevel@tonic-gate
587c478bdstevel@tonic-gate# ROOT directories
597c478bdstevel@tonic-gateROOTMAILD=	$(ROOTLIB)/mail
607c478bdstevel@tonic-gateROOTINC=	$(ROOT)/usr/include
617c478bdstevel@tonic-gate
627c478bdstevel@tonic-gate# installed modules
637c478bdstevel@tonic-gateROOTBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
647c478bdstevel@tonic-gate
657c478bdstevel@tonic-gateROOTSYMLINKS=	$(ROOTBIN)/rmail
667c478bdstevel@tonic-gate
677c478bdstevel@tonic-gate
687c478bdstevel@tonic-gateEDITPATH= \
697c478bdstevel@tonic-gate	sed -e 's!REAL_PATH!/usr/bin!g' \
707c478bdstevel@tonic-gate	    -e 's!USR_SHARE_LIB!/usr/share/lib!g' \
717c478bdstevel@tonic-gate	    -e 's!VAR_MAIL!/var/mail!g' < $? > $@
727c478bdstevel@tonic-gate
737c478bdstevel@tonic-gateCPPFLAGS =	-DSVR4 -I. $(CPPFLAGS.master)
747014882Richard LoweCERRWARN +=	-_gcc=-Wno-implicit-function-declaration
757014882Richard LoweCERRWARN +=	-_gcc=-Wno-unused-variable
76d3b5f56John LevonCERRWARN +=	$(CNOWARN_UNINIT)
777014882Richard LoweCERRWARN +=	-_gcc=-Wno-clobbered
787014882Richard LoweCERRWARN +=	-_gcc=-Wno-extra
797c478bdstevel@tonic-gate
805661bb7John Levon# missing type declarations for old-style functions
815661bb7John LevonSMATCH =	off
825661bb7John Levon
837c478bdstevel@tonic-gateLDLIBS +=	-lmail -lsocket
847c478bdstevel@tonic-gate
8524da5b3rie# mail defines its own delete() - reduce symbols to locals to remove name clash.
8624da5b3rieLDFLAGS +=	$(MAPFILE.NGB:%=-M%)
8724da5b3rie
887c478bdstevel@tonic-gate# conditional assignments
897c478bdstevel@tonic-gate#
907c478bdstevel@tonic-gateall:=		TARGET= all
917c478bdstevel@tonic-gateinstall:=	TARGET= install
927c478bdstevel@tonic-gateclean:=		TARGET= clean
937c478bdstevel@tonic-gateclobber:=	TARGET= clobber
947c478bdstevel@tonic-gatelint:=		TARGET= lint
957c478bdstevel@tonic-gate
967c478bdstevel@tonic-gate# file modes, owners and groups for the install target
977c478bdstevel@tonic-gate#
987c478bdstevel@tonic-gate
997c478bdstevel@tonic-gate
1007c478bdstevel@tonic-gate$(ROOTBIN)/mail :=	FILEMODE =	02511
1017c478bdstevel@tonic-gate
1027c478bdstevel@tonic-gate
1037c478bdstevel@tonic-gate# install rules
1047c478bdstevel@tonic-gate$(ROOTINC)/% : %
1057c478bdstevel@tonic-gate	$(INS.file)
1067c478bdstevel@tonic-gate
1077c478bdstevel@tonic-gate.KEEP_STATE:
1087c478bdstevel@tonic-gate
1097c478bdstevel@tonic-gate.PARALLEL: $(MAILOBJS) $(OBJS)
1107c478bdstevel@tonic-gate
1115661bb7John Levonall:		$(PROG)
1127c478bdstevel@tonic-gate
1137c478bdstevel@tonic-gatemail: 		$(MAILOBJS)
1147c478bdstevel@tonic-gate	$(LINK.c) -o $@ $(MAILOBJS) $(LDLIBS)
1157c478bdstevel@tonic-gate	$(POST_PROCESS)
1167c478bdstevel@tonic-gate
1177c478bdstevel@tonic-gateinstall: all .WAIT $(ROOTBINPROG) $(ROOTSYMLINKS)
1187c478bdstevel@tonic-gate
1197c478bdstevel@tonic-gate# ROOTSYMLINKS
1207c478bdstevel@tonic-gate#
1217c478bdstevel@tonic-gate$(ROOTBIN)/rmail:
1227c478bdstevel@tonic-gate	$(RM) $@; $(SYMLINK) mail $@
1237c478bdstevel@tonic-gate
1245661bb7John Levonlint:
1257c478bdstevel@tonic-gate	$(LINT.c) $(MAILSRC)
1267c478bdstevel@tonic-gate
1277c478bdstevel@tonic-gateclean:
1287c478bdstevel@tonic-gate	$(RM) $(OBJS) $(MAILOBJS)
1297c478bdstevel@tonic-gate
1307c478bdstevel@tonic-gateclobber:
1317c478bdstevel@tonic-gate	$(RM) $(OBJS) $(MAILOBJS) mail
132