xref: /illumos-gate/usr/src/cmd/mailx/Makefile (revision 5aefb6555731130ca4fd295960123d71f2d21fe8)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# cmd/mailx/Makefile
29
30PROG= mailx
31
32OBJS=	myfopen.o aux.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 vars.o
39
40SRCS=	$(OBJS:.o=.c)
41
42VEROBJ=	version.o
43VERSRC= $(VEROBJ:.o=.c)
44MAILXVERSION= 5.0
45MISC= misc
46
47include ../Makefile.cmd
48#
49# for messaging catalogue file
50#
51POFILE= mailx.po
52POFILES= $(SRCS:%.c=%.po)
53
54ROOTMAILXD=	$(ROOTSHLIB)/mailx
55ROOTETCMAILD=	$(ROOTETC)/mail
56MAILXHELP=	mailx.help mailx.help.~
57ROOTMAILXHELP=	$(MAILXHELP:%=$(ROOTMAILXD)/%)
58MAILXRC=	$(MISC)/mailx.rc
59UCBMAILRC=	$(MISC)/Mail.rc
60ROOTMAILXRC=	$(MAILXRC:$(MISC)/%=$(ROOTETCMAILD)/%)
61ROOTUCBMAILRC=	$(UCBMAILRC:$(MISC)/%=$(ROOTETCMAILD)/%)
62ROOTUCBMAIL=	$(ROOT)/usr/ucb/mail
63ROOTUCBCAPMAIL=	$(ROOT)/usr/ucb/Mail
64
65$(ROOTPROG) :=		FILEMODE =	02511
66$(ROOTPROG) :=		GROUP =		mail
67$(ROOTMAILXHELP) :=	FILEMODE =	0644
68$(ROOTMAILXRC) :=	FILEMODE =	0644
69$(ROOTUCBMAILRC) :=	FILEMODE =	0644
70
71CPPFLAGS=	-Ihdr -DUSG -DOPTIM $(CPPFLAGS.master)
72LINTFLAGS= 	-hb
73LDLIBS +=	-lmail
74
75# install rules
76$(ROOTMAILXD)/% : %
77	$(INS.file)
78
79$(ROOTETCMAILD)/% : $(MISC)/%
80	$(INS.file)
81
82.KEEP_STATE:
83
84all: $(PROG) $(MAILXHELP) $(MAILXRC) $(UCBMAILRC)
85
86$(PROG): $(OBJS) $(VEROBJ) $(LIBMAIL)
87	$(LINK.c) $(OBJS) $(VEROBJ) -o $@ $(LDLIBS)
88	$(POST_PROCESS)
89
90$(VEROBJ): $(VERSRC)
91	$(COMPILE.c) $(VERSRC)
92
93# want to recreate version.c whenever (and only when) mailx needs to be rebuilt
94$(VERSRC): $(OBJS) $(LIBMAIL)
95	$(ECHO) "const char *const version=\"mailx version $(MAILXVERSION) `date`\";" > $@
96
97install: all $(ROOTMAILXD) $(ROOTPROG) $(ROOTMAILXHELP) \
98	$(ROOTMAILXRC) $(ROOTUCBMAIL) $(ROOTUCBCAPMAIL) $(ROOTUCBMAILRC)
99
100$(ROOTUCBMAIL) $(ROOTUCBCAPMAIL):
101	$(RM) $@; $(SYMLINK) ../bin/mailx $@
102
103$(ROOTMAILXD):
104	$(INS.dir)
105
106$(MAILXHELP): $(MISC)/$$@
107	$(GREP) -v '^#.*@(' $(MISC)/$@ > $@
108
109$(POFILE):      $(POFILES)
110	$(RM)	$@
111	cat     $(POFILES)      > $@
112
113clean:
114	$(RM) $(OBJS) $(VEROBJS) version.c
115
116lint: lint_SRCS
117
118include ../Makefile.targ
119
120FRC:
121