#
# Makefile for etc subdirectory
#
# $Id: Makefile.in,v 1.1.1.3 1999/06/07 23:02:56 nathanw Exp $
#

SHELL = /bin/sh

top_srcdir = @top_srcdir@
srcdir     = @srcdir@
VPATH      = @srcdir@

prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = @bindir@
libdir      = @libdir@
etcdir      = @sysconfdir@

mailspool    = @mailspool@

INSTALL         = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA    = @INSTALL_DATA@

# Path to search for programs to handle MIME
# content.  Used to create mhn.defaults
MHNSEARCHPATH = "$(PATH):/usr/demo/SOUND"

# Program used to search path for various programs to
# handle MIME content.  Used to create mhn.defaults
MHNSEARCHPROG = $(srcdir)/mhn.find.sh

SED = sed

.SUFFIXES:

# format and components files
DIST_FILES = mhl.body mhl.digest mhl.format mhl.forward mhl.headers \
             mhl.reply scan.default scan.mailx scan.nomime scan.size scan.time \
             scan.timely scan.unseen components digestcomps distcomps \
             forwcomps rcvdistcomps replcomps replgroupcomps MailAliases \
             mhn.defaults

# format and configuration files to generate
GEN_FILES = mts.conf

# data files we need to install
FILES = $(DIST_FILES) $(GEN_FILES)

# scripts to install
SCRIPTS = sendfiles

# auxiliary files
AUX = Makefile.in mhn.defaults.sh mhn.find.sh mts.conf.in

# all files in this directory included in the distribution
DIST = $(DIST_FILES) $(SCRIPTS) $(AUX)

# ========= DEPENDENCIES FOR BUILDING ==========

all: $(GEN_FILES)

mts.conf: $(srcdir)/mts.conf.in
	rm -f $@
	$(SED) -e 's,%mailspool%,$(mailspool),' \
	       -e 's,%etcdir%,$(etcdir),' < $(srcdir)/mts.conf.in > $@

install: install-files install-scripts

install-files:
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(etcdir)
	for file in $(DIST_FILES); do \
	  $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(etcdir)/$$file; \
	done
	for file in $(GEN_FILES); do \
	  $(INSTALL_DATA) $$file $(DESTDIR)$(etcdir)/$$file; \
	done

install-scripts:
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
	for script in $(SCRIPTS); do \
	  $(INSTALL_PROGRAM) $(srcdir)/$$script $(DESTDIR)$(libdir)/$$script; \
	done

uninstall: uninstall-files uninstall-scripts

uninstall-files:
	for file in $(FILES); do \
	  rm -f $(DESTDIR)$(etcdir)/$$file; \
	done

uninstall-scripts:
	for script in $(SCRIPTS); do \
	  rm -f $(DESTDIR)$(libdir)/$$script; \
	done

# ========== DEPENDENCIES FOR CLEANUP ==========

mostlyclean:
	rm -f *~

clean: mostlyclean
	rm -f $(GEN_FILES)

distclean: clean
	rm -f Makefile

realclean: distclean

superclean: realclean

# ========== DEPENDENCIES FOR MAINTENANCE ==========

subdir = etc

Makefile: Makefile.in ../config.status
	cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
 
distdir = ../`cat ../distname`/$(subdir)
nmhdist: $(DIST)
	@echo "Copying distribution files in $(subdir)"
	@for file in $(DIST); do \
	  cp -p $(srcdir)/$$file $(distdir); \
	done

