xref: /illumos-gate/usr/src/cmd/mailwrapper/Makefile (revision 1f606c5b8e527ed924f5cbdbbce612887c7dbe32)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
14# Copyright 2014 Alexander Pyhalov
15# Copyright (c) 2018, Joyent, Inc.
16#
17
18
19LIBPROG=	mailwrapper
20
21PROG=	       $(LIBPROG)
22
23include ../Makefile.cmd
24
25MWOBJS=		fgetln.o fparseln.o mailwrapper.o
26
27CLOBBERFILES=	$(PROG)
28CLEANFILES=	$(MWOBJS)
29
30CPROG=		mailwrapper
31CPROGSRC=	$(CPROG:%=_%.c)
32
33CFS=		mailer.conf
34
35ROOTETCFILES=$(CFS:%=$(ROOTETC)/%)
36
37$(ROOTETCFILES) :=	FILEMODE = 0644
38
39# installed modules
40ROOTLIBPROG=	$(LIBPROG:%=$(ROOTLIB)/%)
41
42ROOTSYMLINKS=	$(ROOTBIN)/mailq \
43		$(ROOTLIB)/sendmail \
44		$(ROOTUSRSBIN)/newaliases \
45		$(ROOTUSRSBIN)/sendmail
46
47CPPFLAGS =	-I. $(CPPFLAGS.master)
48
49SMOFF += all_func_returns
50
51# conditional assignments
52#
53all:=		TARGET= all
54install:=	TARGET= install
55clean:=		TARGET= clean
56clobber:=	TARGET= clobber
57
58# install rules
59$(ROOTINC)/% : %
60	$(INS.file)
61
62.KEEP_STATE:
63
64.PARALLEL: $(MWOBJS) $(OBJS)
65
66all:		$(PROG)
67
68mailwrapper:	$(MWOBJS)
69	$(LINK.c) -o $@ $(MWOBJS) $(LDLIBS)
70	$(POST_PROCESS)
71
72install: all .WAIT $(ROOTLIBPROG) $(ROOTSYMLINKS) $(ROOTETCFILES)
73
74# ROOTSYMLINKS
75#
76$(ROOTBIN)/mailq:
77	$(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
78
79$(ROOTLIB)/sendmail:
80	$(RM) $@; $(SYMLINK) mailwrapper $@
81
82$(ROOTUSRSBIN)/newaliases:
83	$(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
84
85$(ROOTUSRSBIN)/sendmail:
86	$(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
87
88$(ROOTETCMAIL)/%:  %
89	$(INS.file)
90
91clean:
92	$(RM) $(OBJS) $(MWOBJS) mailwrapper
93
94clobber: clean
95	$(RM) $(ROOTSYMLINKS) $(ROOTLIBPROG) $(ROOTETCFILES)
96