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 CFS=            mailer.conf
  45 
  46 ROOTETCFILES=$(CFS:%=$(ROOTETC)/%)
  47 
  48 $(ROOTETCFILES) :=      FILEMODE = 0644
  49 
  50 # installed modules
  51 ROOTLIBPROG=    $(LIBPROG:%=$(ROOTLIB)/%)
  52 
  53 ROOTSYMLINKS=   $(ROOTBIN)/mailq \
  54                 $(ROOTLIB)/sendmail \
  55                 $(ROOTUSRSBIN)/newaliases \
  56                 $(ROOTUSRSBIN)/sendmail
  57 
  58 CPPFLAGS =      -I. $(CPPFLAGS.master)
  59 
  60 LINTFLAGS       += -erroff=E_FUNC_RET_ALWAYS_IGNOR2
  61 
  62 # conditional assignments
  63 #
  64 all:=           TARGET= all
  65 install:=       TARGET= install
  66 clean:=         TARGET= clean
  67 clobber:=       TARGET= clobber
  68 lint:=          TARGET= lint
  69 
  70 # install rules
  71 $(ROOTINC)/% : %
  72         $(INS.file)
  73 
  74 .KEEP_STATE:
  75 
  76 .PARALLEL: $(MWOBJS) $(OBJS)
  77 
  78 all:            $(PROG) 
  79 
  80 mailwrapper:    $(MWOBJS)
  81         $(LINK.c) -o $@ $(MWOBJS) $(LDLIBS)
  82         $(POST_PROCESS)
  83 
  84 install: all .WAIT $(ROOTLIBPROG) $(ROOTSYMLINKS) $(ROOTETCFILES)
  85 
  86 # ROOTSYMLINKS
  87 #
  88 $(ROOTBIN)/mailq: 
  89         $(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
  90 
  91 $(ROOTLIB)/sendmail:
  92         $(RM) $@; $(SYMLINK) mailwrapper $@
  93 
  94 $(ROOTUSRSBIN)/newaliases:
  95         $(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
  96 
  97 $(ROOTUSRSBIN)/sendmail:
  98         $(RM) $@; $(SYMLINK) ../lib/mailwrapper $@
  99 
 100 $(ROOTETCMAIL)/%:  %
 101         $(INS.file)
 102 
 103 lint: 
 104         $(LINT.c) $(SRCS)
 105 
 106 clean:
 107         $(RM) $(OBJS) $(MWOBJS) mailwrapper
 108 
 109 clobber: clean
 110         $(RM) $(ROOTSYMLINKS) $(ROOTLIBPROG) $(ROOTETCFILES)