xref: /dragonfly/share/mk/bsd.symver.mk (revision 0fe46dc6)
1# $FreeBSD$
2
3.if !target(__<bsd.symver.mk>__)
4__<bsd.symver.mk>__:
5
6.include <bsd.init.mk>
7
8# Generate the version map given the version definitions
9# and symbol maps.
10.if !defined(NO_SYMVER) && !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
11# Find the awk script that generates the version map.
12VERSION_GEN?=	version_gen.awk
13VERSION_MAP?=	Version.map
14
15CLEANFILES+=	${VERSION_MAP}
16
17.if exists(${.PARSEDIR}/${VERSION_GEN})
18_vgen:=	${.PARSEDIR}/${VERSION_GEN}
19.else
20.error	${VERSION_GEN} not found in ${.PARSEDIR}
21.endif
22
23# Run the symbol maps through the C preprocessor before passing
24# them to the symbol version generator.
25${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS}
26	cat ${SYMBOL_MAPS} | ${CPP} - - \
27	    | awk -v vfile=${VERSION_DEF} -f ${_vgen} > ${.TARGET}
28.endif	# !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
29.endif  # !target(__<bsd.symver.mk>__)
30