]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/mk/bsd.symver.mk
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / mk / bsd.symver.mk
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 ${MK_SYMVER} == "yes" && !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
11 # Find the awk script that generates the version map.
12 VERSION_GEN?=   version_gen.awk
13 VERSION_MAP?=   Version.map
14
15 CLEANFILES+=    ${VERSION_MAP}
16
17 # Compute the make's -m path.
18 _mpath=
19 _oarg=
20 .for _arg in ${.MAKEFLAGS}
21 .if ${_oarg} == "-m"
22 _mpath+= ${_arg}
23 .endif
24 _oarg=  ${_arg}
25 .endfor
26 _mpath+= /usr/share/mk
27
28 # Look up ${VERSION_GEN} in ${_mpath}.
29 _vgen=
30 .for path in ${_mpath}
31 .if empty(_vgen)
32 .if exists(${path}/${VERSION_GEN})
33 _vgen=  ${path}/${VERSION_GEN}
34 .endif
35 .endif
36 .endfor
37 .if empty(_vgen)
38 .error ${VERSION_GEN} not found in the search path.
39 .endif
40
41 # Run the symbol maps through the C preprocessor before passing
42 # them to the symbol version generator.
43 ${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS}
44         cat ${SYMBOL_MAPS} | ${CPP} - - \
45             | awk -v vfile=${VERSION_DEF} -f ${_vgen} > ${.TARGET}
46 .endif  # !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
47 .endif  # !target(__<bsd.symver.mk>__)