######################################################################
#
# $Id$
#
# Makefile to ease administration of sendmail.
#
######################################################################
#
# CONSTANTS
# Where sendmail's cf directory is located on the system. This value
# varies (annoyingly) based on system (and sometimes release thereof).
#
# It should point to the directory containing the cf/cf.m4 file.
#
# If you install a new sendmail from source, be sure to replace the
# CFDIR directory with the contents of cf/* from the sources.
CFDIR = /usr/share/sendmail/conf
# base name of tarballs created by dist rules
DISTNAME = macosx-server-8.10
# path to the sendmail binary, and pid file location
SENDMAIL = /usr/sbin/sendmail
PIDFILE = /var/run/sendmail.pid
# for portability
MCFILE = sendmail.mc
CFFILE = sendmail.cf
# file to list files that must be hashed with makemap(8)
MAPFILE = Hashed
# database type to use with makemap
HASHTYPE = hash
# how to call makemap
MAKEMAP = makemap
# how to create the tarballs
TARFLAGS = tar -cpPf -
COMPRESS = gzip
SUFFIX = .tar.gz
######################################################################
#
# RULES
# rebuild hashed database files
all:
@grep ^[A-Za-z0-9] $(MAPFILE) | while read l; do \
if [ -f $$l ]; then \
$(MAKEMAP) $(HASHTYPE) $$l < $$l; \
fi \
done
aliases:
@newaliases
# for easy respawning of cf file (assumes all local changes done in
# $(MCFILE) file!)
config: $(CFFILE)
# the funny _CF_DIR_ stuff is to support "traditional" m4 varients
$(CFFILE): $(MCFILE)
@-cp $(CFFILE) $(CFFILE).old 2>/dev/null || true
@m4 -D_CF_DIR_=$(CFDIR)/ $(CFDIR)/m4/cf.m4 $(MCFILE) > $(CFFILE)
# a simple validation of the $(CFFILE) file
test:
$(SENDMAIL) -C -bt < /dev/null
@echo
# for easy reloading of sendmail...
reload: $(CFFILE) $(PIDFILE)
@kill -HUP `head -1 $(PIDFILE)`
# remove hashed database files, emacs backup files, and bundles
# created by dist rules below
clean:
@rm -f *.db *~ $(DISTNAME).tar*
@rm -rf $(DISTNAME)
# sanitize also get rid of $(CFFILE) and cohorts
realclean: clean
@rm -f $(CFFILE)*
# create a tarball of the current directory contents
dist:
@rm -rf $(DISTNAME) $(DISTNAME).tar*
@$(TARFLAGS) . | $(COMPRESS) > /var/tmp/$(DISTNAME)$(SUFFIX)
@mv /var/tmp/$(DISTNAME)$(SUFFIX) .
@echo $(DISTNAME)$(SUFFIX)