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 # Copyright 2014 Alexander Pyhalov
  24 # Use is subject to license terms.
  25 #
  26 
  27 
  28 LIBPROG=        mailwrapper 
  29 
  30 PROG=          $(LIBPROG)
  31 
  32 include ../Makefile.cmd
  33 
  34 MWOBJS=         fgetln.o fparseln.o mailwrapper.o
  35 
  36 CLOBBERFILES=   $(PROG)
  37 CLEANFILES=     $(MWOBJS)
  38 
  39 SRCS=           $(MWOBJS:%.o=%.c)
  40 
  41 CPROG=          mailwrapper
  42 CPROGSRC=       $(CPROG:%=_%.c)
  43 
  44 ROOTETCMAIL=    $(ROOTETC)/mail
  45 
  46 CFS=            mailer.conf
  47 
  48 ROOTETCMAILFILES=$(CFS:%=$(ROOTETCMAIL)/%)
  49 
  50 $(ROOTETCMAILFILES) :=  FILEMODE = 0644
  51 
  52 # installed modules
  53 ROOTLIBPROG=    $(LIBPROG:%=$(ROOTLIB)/%)
  54 
  55 ROOTSYMLINKS=   $(ROOTBIN)/mailq \
  56                 $(ROOTLIB)/sendmail \
  57                 $(ROOTUSRSBIN)/newaliases \
  58                 $(ROOTUSRSBIN)/sendmail
  59 
  60 CPPFLAGS =      -I. $(CPPFLAGS.master)
  61 
  62 LINTFLAGS       += -erroff=E_FUNC_RET_ALWAYS_IGNOR2
  63 
  64 # conditional assignments
  65 #
  66 all:=           TARGET= all
  67 install:=       TARGET= install
  68 clean:=         TARGET= clean
  69 clobber:=       TARGET= clobber
  70 lint:=          TARGET= lint
  71 
  72 # install rules
  73 $(ROOTINC)/% : %
  74         $(INS.file)
  75 
  76 .KEEP_STATE:
  77 
  78 .PARALLEL: $(MWOBJS) $(OBJS)
  79 
  80 all:            $(PROG) 
  81 
  82 mailwrapper:    $(MWOBJS)
  83         $(LINK.c) -o $@ $(MWOBJS) $(LDLIBS)
  84         $(POST_PROCESS)
  85 
  86 install: all .WAIT $(ROOTLIBPROG) $(ROOTSYMLINKS) $(ROOTETCMAILFILES)
  87 
  88 # ROOTSYMLINKS
  89 #
  90 $(ROOTBIN)/mailq: 
  91         $(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
  92 
  93 $(ROOTLIB)/sendmail:
  94         $(RM) $@; $(SYMLINK) mailwrapper $@
  95 
  96 $(ROOTUSRSBIN)/newaliases:
  97         $(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
  98 
  99 $(ROOTUSRSBIN)/sendmail:
 100         $(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
 101 
 102 $(ROOTETCMAIL)/%:  %
 103         $(INS.file)
 104 
 105 lint: 
 106         $(LINT.c) $(SRCS)
 107 
 108 clean:
 109         $(RM) $(OBJS) $(MWOBJS) mailwrapper
 110 
 111 clobber: clean
 112         $(RM) $(ROOTSYMLINKS) $(ROOTLIBPROG) $(ROOTETCMAILFILES)