freebsd-dev/share/mk/bsd.symver.mk
Alexander Kabaev 2da4e4706d Break out Version.map generation code from bsd.lib.mk into a
separate bsd.symver.mk file. Include bsd.symver.mk in bsd.lib.mk
to maintain the status quo.
2007-04-03 18:56:05 +00:00

43 lines
917 B
Makefile

# $FreeBSD$
.if !target(__<bsd.symver.mk>__)
__<bsd.symver.mk>__:
.include <bsd.init.mk>
# Generate the version map given the version definitions
# and symbol maps.
.if !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
# Find the awk script that generates the version map.
VERSION_GEN?= version_gen.awk
VERSION_MAP?= Version.map
CLEANFILES+= ${VERSION_MAP}
# Compute the make's -m path.
_mpath=
_oarg=
.for _arg in ${.MAKEFLAGS}
.if ${_oarg} == "-m"
_mpath+= ${_arg}
.endif
_oarg= ${_arg}
.endfor
_mpath+= /usr/share/mk
# Look up ${VERSION_GEN} in ${_mpath}.
_vgen=
.for path in ${_mpath}
.if empty(_vgen)
.if exists(${path}/${VERSION_GEN})
_vgen= ${path}/${VERSION_GEN}
.endif
.endif
.endfor
${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS}
awk -v vfile=${VERSION_DEF} -f ${_vgen} ${SYMBOL_MAPS} \
> ${.TARGET}
.endif # !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
.endif # !target(__<bsd.symver.mk>__)