
DEBUG=
CFLAGS= ${DEBUG}
LIBS=
CC=cc
LD=cc
INSTALL=install -s
RPCGEN=rpcgen

CP=cp
CLEAN=rm -f

PROT=bootparam_prot.x
SRCPROT=/usr/include/rpcsvc/bootparam_prot.x

HEADER=bootparam_prot.h
TARGETS=rpc.bootparamd callbootd
LOCATION=/usr/local/etc
MANLOCATION=/usr/local/man/man8
DIST=README main.c rpc.bootparamd.c callbootd.c bootparamd.8 Makefile


all:	${TARGETS}

rpc.bootparamd: ${HEADER} bootparam_prot_svc.o bootparam_prot_xdr.o \
		rpc.bootparamd.o main.o
	${LD} $(CFLAGS) -o rpc.bootparamd bootparam_prot_svc.o \
		bootparam_prot_xdr.o rpc.bootparamd.o main.o $(LIBS)

callbootd: ${HEADER} callbootd.o bootparam_prot_clnt.o bootparam_prot_xdr.o 
	${LD} $(CFLAGS) -o callbootd callbootd.o bootparam_prot_clnt.o \
		bootparam_prot_xdr.o $(LIBS)

bootparam_prot.h: ${PROT}
	${RPCGEN} -h -o $@ ${PROT}

bootparam_prot_xdr.c: ${HEADER} 
	${RPCGEN} -c -o $@ ${PROT}

bootparam_prot_clnt.c: ${HEADER}
	${RPCGEN} -l -o $@ ${PROT}

bootparam_prot_svc.c: ${HEADER} 
	${RPCGEN} -m -o $@ ${PROT}

${PROT}: 
	@echo "You'll have to do an \"make installprot\" first"
	@false
	
installprot: ${SRCPROT}
	${CP}  ${SRCPROT} ${PROT}


.o:	${HEADER}
	${CC} -c $(CFLAGS) $*.c 

install: ${TARGETS}
	${INSTALL} ${TARGETS} ${LOCATION}
	${INSTALL} ${MANUALS} ${MANLOCATION}

clean:
	${CLEAN} *.o ${TARGETS} a.out bootparam_prot_* bootparam_prot.h *~ #* 

allclean: 	clean
	rm -f ${PROT}

dist:
	rm -f bootparams.shar
	shar ${DIST} > bootparams.shar
