xref: /illumos-gate/usr/src/cmd/mailx/Makefile (revision 8119dad84d6416f13557b0ba8e2aaf9064cbcfd3)
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 2018 Joyent, Inc.
26# Copyright 2019 Garrett D'Amore <garrett@damore.org>
27#
28# cmd/mailx/Makefile
29
30PROG= mailx
31
32OBJS=	myfopen.o cmd1.o cmd2.o cmd3.o \
33	cmd4.o cmdtab.o collect.o config.o edit.o \
34	init.o fio.o getname.o head.o \
35	hostname.o lex.o list.o lock.o lpaths.o \
36	main.o names.o optim.o popen.o quit.o \
37	receipt.o send.o sigretro.o stralloc.o temp.o \
38	translate.o tty.o usg.local.o util.o vars.o
39
40SRCS=	$(OBJS:.o=.c)
41
42MISC= misc
43
44include ../Makefile.cmd
45#
46# for messaging catalogue file
47#
48POFILE= mailx.po
49POFILES= $(SRCS:%.c=%.po)
50
51ROOTMAILXD=	$(ROOTSHLIB)/mailx
52ROOTETCMAILD=	$(ROOTETC)/mail
53MAILXHELP=	mailx.help mailx.help.~
54ROOTMAILXHELP=	$(MAILXHELP:%=$(ROOTMAILXD)/%)
55MAILXRC=	$(MISC)/mailx.rc
56UCBMAILRC=	$(MISC)/Mail.rc
57ROOTMAILXRC=	$(MAILXRC:$(MISC)/%=$(ROOTETCMAILD)/%)
58ROOTUCBMAILRC=	$(UCBMAILRC:$(MISC)/%=$(ROOTETCMAILD)/%)
59ROOTUCBMAIL=	$(ROOT)/usr/ucb/mail
60ROOTUCBCAPMAIL=	$(ROOT)/usr/ucb/Mail
61
62$(ROOTPROG) :=		FILEMODE =	02511
63$(ROOTMAILXHELP) :=	FILEMODE =	0644
64$(ROOTMAILXRC) :=	FILEMODE =	0644
65$(ROOTUCBMAILRC) :=	FILEMODE =	0644
66
67CPPFLAGS=	-Ihdr -DUSG -DOPTIM $(CPPFLAGS.master)
68CERRWARN +=	-_gcc=-Wno-parentheses
69CERRWARN +=	$(CNOWARN_UNINIT)
70CERRWARN +=	-_gcc=-Wno-unused-variable
71CERRWARN +=	-_gcc=-Wno-clobbered
72# not linted
73SMATCH=off
74
75LDLIBS +=	-lmail -lcustr
76LDFLAGS +=	$(MAPFILE.NGB:%=-Wl,-M%)
77
78CLOBBERFILES += $(MAILXHELP)
79
80# install rules
81$(ROOTMAILXD)/% : %
82	$(INS.file)
83
84$(ROOTETCMAILD)/% : $(MISC)/%
85	$(INS.file)
86
87.KEEP_STATE:
88
89all: $(PROG) $(MAILXHELP) $(MAILXRC) $(UCBMAILRC)
90
91$(PROG): $(OBJS) $(LIBMAIL)
92	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
93	$(POST_PROCESS)
94
95install: all $(ROOTMAILXD) $(ROOTPROG) $(ROOTMAILXHELP) \
96	$(ROOTMAILXRC) $(ROOTUCBMAIL) $(ROOTUCBCAPMAIL) $(ROOTUCBMAILRC)
97
98$(ROOTUCBMAIL) $(ROOTUCBCAPMAIL):
99	$(RM) $@; $(SYMLINK) ../bin/mailx $@
100
101$(ROOTMAILXD):
102	$(INS.dir)
103
104$(MAILXHELP): $(MISC)/$$@
105	$(GREP) -v '^#.*@(' $(MISC)/$@ > $@
106
107$(POFILE):      $(POFILES)
108	$(RM)	$@
109	cat     $(POFILES)      > $@
110
111clean:
112	$(RM) $(OBJS)
113
114include ../Makefile.targ
115
116FRC:
117