#! smake
#	$Header: /usr/people/sam/fax/util/RCS/Makefile,v 1.45 93/04/18 18:05:52 sam Rel $
#
# FlexFAX Facsimile Software
#
# Copyright (c) 1990, 1991, 1992, 1993 Sam Leffler
# Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
# 
# 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.
#
DEPTH=..
include ${DEPTH}/defs

C++FILES=\
    Array.c++ \
    Dictionary.c++ \
    Obj.c++ \
    StackBuffer.c++ \
    Str.c++ \
    StrArray.c++ \
    \
    FaxDB.c++ \
    FaxClient.c++ \
    Fatal.c++ \
    ${NULL}
CFILES=\
    fxassert.c \
    ${NULL}
TARGETS=libfaxutil.a faxsubmit faxquit faxanswer faxinfo

default all::
	@${MAKE} incdepend
	@${MAKE} targets

targets: $(TARGETS)

include ${COMMONRULES}

libfaxutil.a: ${OBJECTS}
	@rm -f $@;
	@echo "${AR} ${AROPTS} $@ ${OBJECTS}";\
	   ${AR} ${AROPTS} $@ ${OBJECTS} $(C++FILT)
	${RANLIB} $@
../util/libfaxutil.a: libfaxutil.a

faxsubmit: faxsubmit.c ${LIBS}
	${CCF} -o $@ faxsubmit.c ${LDFLAGS}
faxquit: faxquit.c ${LIBS}
	${CCF} -o $@ faxquit.c ${LDFLAGS}
faxanswer: faxanswer.c ${LIBS}
	${CCF} -o $@ faxanswer.c ${LDFLAGS}
faxinfo: faxinfo.c ${LIBS}
	${CCF} -o $@ faxinfo.c ${LDFLAGS}

PUTSUID=${INSTALL} -m 4755 -u ${FAXUSER} -idb ${PRODUCT}.sw.server
PUTPRIV=${INSTALL} -m 4750 -u ${FAXUSER} -g ${FAXGROUP} \
    -idb ${PRODUCT}.sw.server
PUTSERV=${INSTALL} -m 755 -idb ${PRODUCT}.sw.server
PUTCSUG=${INSTALL} -m 755 -idb "${PRODUCT}.sw.client config(suggest)"
PUTSSUG=${INSTALL} -m 755 -idb "${PRODUCT}.sw.server config(suggest)"

install: default
	${PUTSUID} -F ${BIN} -O faxanswer faxquit
	${PUTSERV} -F ${SPOOL}/bin -O faxsubmit
	${PUTPRIV} -F ${SPOOL}/bin -O faxinfo faxquit
	${PUTSERV} -F ${SPOOL}/bin -src submit2at.sh -O submit2at
	${PUTSERV} -F ${SPOOL}/bin -src ps2fax.gs.sh -O ps2fax.gs
	${PUTSERV} -F ${SPOOL}/bin -src ps2fax.dps.sh -O ps2fax.dps
	${PUTSSUG} -F ${SPOOL}/bin -src notify.sh -O notify
	${PUTSSUG} -F ${SPOOL}/bin -src deliver.sh -O deliver
	${PUTSERV} -F ${SPOOL}/bin -src rts.sh -O rts
	${PUTSERV} -F ${SPOOL}/bin -src transcript.sh -O transcript
	${INSTALL} -F ${SPOOL}/etc -m 444 \
	    -idb ${PRODUCT}.sw.server -O dpsprinter.ps 
	${INSTALL} -F ${SPOOL}/bin -idb "${PRODUCT}.sw.server config(suggest)"\
	     -ln ${SPOOL}/bin/ps2fax.${PSIMAGER} -O ps2fax
