/* 
 * Makefile for the FX (file exchange) protocol
 *
 * $Id: Imakefile,v 1.4 1999/03/31 21:48:18 nathanw Exp $
 *
 *
 * Copyright 1989, 1990 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <mit-copyright.h>.
 *
 */

AnsiCC()

#ifdef sgi
RPCGEN=rpcgen
#else
RPCGEN=rpcgen -C
#endif
INCLUDES = -I../include

/* Define KERBEROS for Kerberos support */
DEFKRB = -DKERBEROS

/* Define HESIOD for Hesiod support (not meaningful in protocol) */
/*#DEFHES = -DHESIOD */

/* Define MULTI for multiple server support */
/*#DEFMULTI = -DMULTI */

/* 
 * Define DEBUG for command debugging messages
 * Define DEBUGDB for db debugging messages
 * Define DEBUGMULTI for debugging multiple server support
 * Define MALLOC_LEAK for malloc scribble checking and function tracing
*/
DEFDEBUG = -DMALLOC_LEAK

DEFINES = ${INCLUDES} ${DEFKRB} ${DEFHES} ${DEFMULTI} ${DEFDEBUG}

build_program(ansify,ansify.o,,)
all:: fx_prot_svc.o fx_prot_clnt.o fx_prot_xdr.o

fx_prot_svc.o: fx_prot_svc.c
fx_prot_clnt.o: fx_prot_clnt.c
fx_prot_xdr.o: fx_prot_xdr.c

fx_prot_svc.c fx_prot_clnt.c fx_prot_xdr.c: fx_prot.x
	${RPCGEN} fx_prot.x
	cat xdr_extras.c >> fx_prot_xdr.c
	rm -f fx_prot_svc.c
	${RPCGEN} -m -o fx_prot_svc.c fx_prot.x
/* IRIX (as of 6.3) doesn't support rpcgen -C the way other operating
 * systems do.  Instead, we have to convert the server call names by
 * hand. */
#ifdef sgi
	sed -e '/local = /s/_1/_1_svc/' fx_prot_svc.c > fx_prot_svc.new
	mv fx_prot_svc.new fx_prot_svc.c
	sed -f svcdecls.sed fx_prot.h > fx_prot.new
	mv fx_prot.new fx_prot.h
#endif
	rm -f ../include/fx_prot.h
	mv fx_prot.h ../include/fx_prot.h

clean::
	rm -f *.o fx_prot_svc.c fx_prot_clnt.c fx_prot_xdr.c fx_prot.h
