xref: /illumos-gate/usr/src/cmd/mailx/Makefile (revision 2b77347cd95dc12475fe2af8a715097166d0523a)
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
75LINTFLAGS=	-hb
76LDLIBS +=	-lmail -lcustr
77LDFLAGS +=	$(MAPFILE.NGB:%=-M%)
78
79CLOBBERFILES += $(MAILXHELP)
80
81# install rules
82$(ROOTMAILXD)/% : %
83	$(INS.file)
84
85$(ROOTETCMAILD)/% : $(MISC)/%
86	$(INS.file)
87
88.KEEP_STATE:
89
90all: $(PROG) $(MAILXHELP) $(MAILXRC) $(UCBMAILRC)
91
92$(PROG): $(OBJS) $(LIBMAIL)
93	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
94	$(POST_PROCESS)
95
96install: all $(ROOTMAILXD) $(ROOTPROG) $(ROOTMAILXHELP) \
97	$(ROOTMAILXRC) $(ROOTUCBMAIL) $(ROOTUCBCAPMAIL) $(ROOTUCBMAILRC)
98
99$(ROOTUCBMAIL) $(ROOTUCBCAPMAIL):
100	$(RM) $@; $(SYMLINK) ../bin/mailx $@
101
102$(ROOTMAILXD):
103	$(INS.dir)
104
105$(MAILXHELP): $(MISC)/$$@
106	$(GREP) -v '^#.*@(' $(MISC)/$@ > $@
107
108$(POFILE):      $(POFILES)
109	$(RM)	$@
110	cat     $(POFILES)      > $@
111
112clean:
113	$(RM) $(OBJS)
114
115lint: lint_SRCS
116
117include ../Makefile.targ
118
119FRC:
120