#!smake
#	$Id: Makefile.in,v 1.10 2001/02/06 04:54:06 tim Exp $
#
# @WARNING@
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
# 
# Permission to use, copy, modify, distribute, and sell this software and 
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
# 
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
# 
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
# OF THIS SOFTWARE.
#

#
# VERSION:	@VERSION@
# DATE:		@DATE@
# TARGET:	@TARGET@
# CCOMPILER:	@CCOMPILER@
# CXXCOMPILER:	@CXXCOMPILER@
#
DEPTH=..
@MAKEINCLUDE@ @MAKELQUOTE@${DEPTH}/defs@MAKERQUOTE@

SRCDIR	= ${DEPTH}/${TOPSRCDIR}/etc
VPATH	= ../@SRCDIR@/etc
DIR_SYSVINIT	= @SYSVINITDIR@
DIR_SYSVINITSTART	= @SYSVINITSTARTDIR@
DIR_SYSVINITSTOP	= @SYSVINITSTOPDIR@
MANNUM4_5		= @MANNUM4_5@
MANNUM1_8		= @MANNUM1_8@
NAME_SYSVINITSTART	= @SYSVINITSTARTNAME@
NAME_SYSVINITSTOP	= @SYSVINITSTOPNAME@

DIALRULES=dialrules \
	dialrules.sf-ba \
	dialrules.europe
TARGETS	= config.fax hosts.hfaxd xferfaxlog lockname ondelay

default all::
	@${MAKE} targets

targets: ${TARGETS}

@MAKEINCLUDE@ @MAKELQUOTE@${COMMONRULES}@MAKERQUOTE@

hosts.hfaxd:
	${ECHO} "localhost" >hosts.hfaxd
	${ECHO} "127.0.0.1" >>hosts.hfaxd
xferfaxlog:
	${ECHO} >xferfaxlog
config.fax:
	${ECHO} on >config.fax
lockname: ${SRCDIR}/lockname.c
	${CCF} -o $@ ${SRCDIR}/lockname.c
ondelay: ${SRCDIR}/ondelay.c
	${CCF} -o $@ ${SRCDIR}/ondelay.c

PUTSERVER	= ${INSTALL} -idb ${PRODUCT}.sw.server
PUTSAMPLE	= ${PUTSERVER} -u ${FAXUSER} -g ${FAXGROUP} \
		  -idb "config(noupdate)"

install: default
	${PUTSERVER} -F ${SBIN} -m 755 -src faxaddmodem.sh -O faxaddmodem
	${PUTSERVER} -F ${SBIN} -m 755 -src faxsetup.sh -O faxsetup
	for i in bsdi irix linux; do \
	    ${PUTSERVER} -F ${SBIN} -m 755 \
		-src ${SRCDIR}/faxsetup.$$i -O faxsetup.$$i; \
	done
	${PUTSERVER} -F ${SBIN} -m 755 -src probemodem.sh -O probemodem
	${PUTSAMPLE} -F ${SPOOL}/etc -m 644 -o xferfaxlog
	${PUTSAMPLE} -F ${SPOOL}/etc -m 600 -o hosts.hfaxd
	for i in ${DIALRULES}; do \
	    ${PUTSERVER} -F ${SPOOL}/etc -m 444 -src ${SRCDIR}/$$i \
		-idb "config(update)" -O $$i; \
	done
	${PUTSERVER} -F ${LIBEXEC} -m 755 -O lockname ondelay
	${PUTSAMPLE} -F ${SPOOL}/etc -m 644 -idb nostrip \
	    -src ${SRCDIR}/lutRS18.pcf -O lutRS18.pcf

#
# System V-specific init support.
#
installSysVInit: hylafax
	if [ "@SYSVINIT@" = yes ]; then \
	    ${PUTSERVER} -F ${DIR_SYSVINIT} -m 755 -O hylafax; \
	    echo "checking ${DIR_SYSVINITSTART} directories"; \
	    for i in ${DIR_SYSVINITSTART}; do \
		if test -d ${DIR_SYSVINIT}/$$i; then \
		    ${PUTSERVER} -F ${DIR_SYSVINIT}/$$i -lns ../`basename ${DIR_SYSVINIT}`/hylafax ${NAME_SYSVINITSTART}; \
		fi; \
	    done; \
	    echo "checking ${DIR_SYSVINITSTOP} directories"; \
	    for i in ${DIR_SYSVINITSTOP}; do \
		if test -d ${DIR_SYSVINIT}/$$i; then \
		    ${PUTSERVER} -F ${DIR_SYSVINIT}/$$i -lns ../`basename ${DIR_SYSVINIT}`/hylafax ${NAME_SYSVINITSTOP}; \
		fi; \
	    done; \
	else \
	    ${PUTSERVER} -F ${SBIN} -m 755 hylafax; \
	fi
	if test -d /etc/config; then \
	    ${PUTSERVER} -F /etc/config -m 644 -src config.fax -O fax; \
	fi

installClient: default
	${PUTSERVER} -F ${SBIN} -m 755 -src faxsetup.sh -O faxsetup
	for i in bsdi irix linux; do \
	    ${PUTSERVER} -F ${SBIN} -m 755 \
		-src ${SRCDIR}/faxsetup.$$i -O faxsetup.$$i; \
	done

#
# These targets are created during the configuration procedure.
#
clobberconfig:
	-${RM} -f hylafax probemodem.sh faxaddmodem.sh faxsetup.sh

