Common makefile fragment for invoking rpcgen. See bsd.README for

documentation on the parameters which control this fragment's behavior.
This commit is contained in:
sommerfeld 2003-01-05 19:18:52 +00:00
parent a74ab65529
commit d4b8f1f9fe
2 changed files with 81 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.README,v 1.108 2002/12/20 16:05:16 jwise Exp $
# $NetBSD: bsd.README,v 1.109 2003/01/05 19:18:52 sommerfeld Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new make "include" files for the BSD
@ -858,4 +858,24 @@ It is important that Makefiles (such as those under src/distrib) that
wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
rather than make assumptions about the location of the compiled kernel.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.rpc.mk> contains a makefile fragment used to
construct source files built by rpcgen.
The following macros may be defined in makefiles which include
<bsd.rpc.mk> in order to control which files get built and how they
are to be built:
RPC_INCS: construct .h file from .x file
RPC_XDRFILES: construct _xdr.c from .x file
(for marshalling/unmarshalling data types)
RPC_SVCFILES: construct _svc.c from .x file
(server-side stubs)
RPC_SVCFLAGS: Additional flags passed to builds of RPC_SVCFILES.
RPC_XDIR: Directory containing .x/.h files
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

60
share/mk/bsd.rpc.mk Normal file
View File

@ -0,0 +1,60 @@
# $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