]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.symver.mk
Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41
[FreeBSD/FreeBSD.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 !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 .if ${MAKE_VERSION} >= 20230123
18 _mpath= ${.SYSPATH}
19 .else
20 # Compute the make's -m path.
21 _mpath=
22 _oarg=
23 .for _arg in ${.MAKEFLAGS}
24 .if ${_oarg} == "-m"
25 _mpath+= ${_arg}
26 .endif
27 _oarg=  ${_arg}
28 .endfor
29 _mpath+= /usr/share/mk
30 .endif
31
32 # Look up ${VERSION_GEN} in ${_mpath}.
33 _vgen=
34 .for path in ${_mpath}
35 .if empty(_vgen)
36 .if exists(${path}/${VERSION_GEN})
37 _vgen=  ${path}/${VERSION_GEN}
38 .endif
39 .endif
40 .endfor
41 .if empty(_vgen)
42 .error ${VERSION_GEN} not found in the search path.
43 .endif
44
45 # Run the symbol maps through the C preprocessor before passing
46 # them to the symbol version generator.
47 ${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS}
48         cat ${SYMBOL_MAPS} | ${CPP} - - \
49             | awk -v vfile=${VERSION_DEF} -f ${_vgen} > ${.TARGET}
50 .endif  # !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
51 .endif  # !target(__<bsd.symver.mk>__)