NetBSD/share/mk/bsd.rpc.mk
sommerfeld d4b8f1f9fe Common makefile fragment for invoking rpcgen. See bsd.README for
documentation on the parameters which control this fragment's behavior.
2003-01-05 19:18:52 +00:00

61 lines
1.1 KiB
Makefile

# $NetBSD: bsd.rpc.mk,v 1.1 2003/01/05 19:18:52 sommerfeld Exp $
# Resolve rpcgen's path, to allow it to be a dependency.
RPCGEN?= rpcgen
RPC_XDIR?= ${.CURDIR}/
_RPCGEN:= ${RPCGEN:M*rpcgen}
.if ${_RPCGEN:M/*} == ""
_RPCGEN!= type ${RPCGEN} | awk '{print $$NF}'
.endif
# We don't use implicit suffix rules here to avoid dependencies in the
# Installed files.
.if defined(RPC_INCS)
.for I in ${RPC_INCS}
${I}: ${I:.h=.x} ${_RPCGEN}
${RPCGEN} -C -h ${RPC_XDIR}${I:.h=.x} -o ${.TARGET}
.endfor
CLEANFILES += ${RPC_INCS}
.depend: ${RPC_INCS}
.endif
.if defined(RPC_XDRFILES)
.for I in ${RPC_XDRFILES}
${I}: ${I:_xdr.c=.x} ${_RPCGEN}
${RPCGEN} -C -c ${RPC_XDIR}${I:_xdr.c=.x} -o ${.TARGET}
.endfor
CLEANFILES += ${RPC_XDRFILES}
.depend: ${RPC_XDRFILES}
.endif
.if defined(RPC_SVCFILES)
.for I in ${RPC_SVCCLASS}
_RPCS += -s ${I}
.endfor
.for I in ${RPC_SVCFILES}
${I}: ${RPC_XDIR}${I:_svc.c=.x} ${_RPCGEN}
${RPCGEN} -C ${_RPCS} ${RPC_SVCFLAGS} ${RPC_XDIR}${I:_svc.c=.x} \
-o ${.TARGET}
.endfor
CLEANFILES += ${RPC_SVCFILES}
.depend: ${RPC_SVCFILES}
.endif