xref: /illumos-gate/usr/src/cmd/mail/Makefile (revision 02b17e23cf5bf66a5ea787e066ae3d1aa49bd856)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright (c) 2018, Joyent, Inc.
26#
27
28BINPROG=	mail
29
30PROG=	       $(BINPROG)
31
32include ../Makefile.cmd
33
34CLOBBERFILES=	$(PROG)
35CLEANFILES=	$(MAILOBJS)
36
37MAILOBJS=	add_recip.o cat.o ckdlivopts.o \
38		cksaved.o clr_hinfo.o copyback.o copylet.o \
39		copymt.o createmf.o del_recipl.o Dout.o	 delete.o \
40		done.o doopen.o dumpaff.o dumprcv.o \
41		errmsg.o gendeliv.o getarg.o getcomment.o \
42		gethead.o goback.o init.o \
43		isheader.o isit.o islocal.o istext.o legal.o \
44		lock.o	main.o mkdead.o mta_ercode.o \
45		new_recipl.o parse.o pckaffspot.o pckrcvspot.o \
46		pickFrom.o pipletr.o poplist.o printhdr.o printmail.o \
47		pushlist.o savehdrs.o sel_disp.o  sendlist.o \
48		sendmail.o  setsig.o \
49		stamp.o Tout.o
50
51MAILSRC=	 $(MAILOBJS:%.o=%.c)
52
53CPROG=		mail
54CPROGSRC=	$(CPROG:%=_%.c)
55
56# ROOT directories
57ROOTMAILD=	$(ROOTLIB)/mail
58ROOTINC=	$(ROOT)/usr/include
59
60# installed modules
61ROOTBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
62
63ROOTSYMLINKS=	$(ROOTBIN)/rmail
64
65
66EDITPATH= \
67	$(SED) -e 's!REAL_PATH!/usr/bin!g' \
68	    -e 's!USR_SHARE_LIB!/usr/share/lib!g' \
69	    -e 's!VAR_MAIL!/var/mail!g' < $? > $@
70
71CPPFLAGS =	-DSVR4 -I. $(CPPFLAGS.master)
72CERRWARN +=	-_gcc=-Wno-implicit-function-declaration
73CERRWARN +=	-_gcc=-Wno-unused-variable
74CERRWARN +=	$(CNOWARN_UNINIT)
75CERRWARN +=	-_gcc=-Wno-clobbered
76CERRWARN +=	-_gcc=-Wno-extra
77
78# missing type declarations for old-style functions
79SMATCH =	off
80
81LDLIBS +=	-lmail -lsocket
82
83# mail defines its own delete() - reduce symbols to locals to remove name clash.
84LDFLAGS +=	$(MAPFILE.NGB:%=-Wl,-M%)
85
86# conditional assignments
87#
88all:=		TARGET= all
89install:=	TARGET= install
90clean:=		TARGET= clean
91clobber:=	TARGET= clobber
92
93# file modes, owners and groups for the install target
94#
95$(ROOTBIN)/mail :=	FILEMODE =	02511
96
97
98# install rules
99$(ROOTINC)/% : %
100	$(INS.file)
101
102.KEEP_STATE:
103
104.PARALLEL: $(MAILOBJS) $(OBJS)
105
106all:		$(PROG)
107
108mail:		$(MAILOBJS)
109	$(LINK.c) -o $@ $(MAILOBJS) $(LDLIBS)
110	$(POST_PROCESS)
111
112install: all .WAIT $(ROOTBINPROG) $(ROOTSYMLINKS)
113
114# ROOTSYMLINKS
115#
116$(ROOTBIN)/rmail:
117	$(RM) $@; $(SYMLINK) mail $@
118
119clean:
120	$(RM) $(OBJS) $(MAILOBJS)
121
122clobber:
123	$(RM) $(OBJS) $(MAILOBJS) mail
124