Changeset View
Standalone View
share/mk/bsd.lib.mk
Show First 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | |||||
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) | .if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) | ||||
# Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR | # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR | ||||
@${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} | @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} | ||||
.endif | .endif | ||||
${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} | ${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} | ||||
${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} | ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} | ||||
.endif | .endif | ||||
.if !target(${SHLIB_NAME}.symbols) | |||||
sjg: It is conventional to have white-space after `=`
same applies to all below | |||||
Done Inline ActionsI've added spaces as with earlier assignments in the file. Overall the file needs a sweep as there are spaces, tabs, and nothing... brooks: I've added spaces as with earlier assignments in the file. Overall the file needs a sweep as… | |||||
SYMREF?=symref.awk | |||||
Done Inline ActionsPerhaps && !target(${SHLIB_NAME}.symbols) sjg: Perhaps `&& !target(${SHLIB_NAME}.symbols)`
so a local*mk could provide an alternative… | |||||
Done Inline ActionsI've added this guard, but I'm not quite sure it's the right one. The question is, what do we want to be pluggable? brooks: I've added this guard, but I'm not quite sure it's the right one. The question is, what do we… | |||||
.if ${MAKE_VERSION} >= 20230123 | |||||
_mpath= ${.SYSPATH} | |||||
Done Inline ActionsWhy printf when echo would do? sjg: Why printf when echo would do? | |||||
Done Inline ActionsThis file needs to not contain the string @generated or tools like Phabricator will treat it as a generated file and not display diffs by default. printf accomplishes this. brooks: This file needs to not contain the string `@generated` or tools like Phabricator will treat it… | |||||
Done Inline ActionsYou could do ? echo ${:U@}generated sjg: You could do ?
`echo ${:U@}generated` | |||||
.else | |||||
# Compute the make's -m path. | |||||
_mpath= | |||||
sjgUnsubmitted Not Done Inline Actionsfwiw this whole for loop can be replaced with ie. treat .MAKESYSFLAGS as one big string, lose the space after -m sjg: fwiw this whole for loop can be replaced with
`_mpath := ${.MAKEFLAGS:tW:S/-m /-m/g:tw:M-m*:S/… | |||||
_oarg= | |||||
.for _arg in ${.MAKEFLAGS} | |||||
.if ${_oarg} == "-m" | |||||
_mpath+= ${_arg} | |||||
.endif | |||||
Not Done Inline ActionsMy last request: can we avoid using hidden file names for symrefs? Why should we hide them? kib: My last request: can we avoid using hidden file names for symrefs? Why should we hide them? | |||||
Done Inline ActionsIt feels noisy to me to have them visible, particularly when they are MD, but I've waffled on this. brooks: It feels noisy to me to have them visible, particularly when they are MD, but I've waffled on… | |||||
Not Done Inline ActionsPut them into a subdir? kib: Put them into a subdir? | |||||
_oarg= ${_arg} | |||||
Done Inline ActionsThere's some argument this shouldn't include ${SHLIB_NAME} and maybe they should be dot files to keep them out of the way in the normal course of things. brooks: There's some argument this shouldn't include ${SHLIB_NAME} and maybe they should be dot files… | |||||
Done Inline Actionswhat's wrong with .if make(check-symbols) ? sjg: what's wrong with `.if make(check-symbols)` ? | |||||
.endfor | |||||
_mpath+= /usr/share/mk | |||||
.endif | |||||
# Look up ${VERSION_GEN} in ${_mpath}. | |||||
_symref= | |||||
.for path in ${_mpath} | |||||
.if empty(_symref) | |||||
.if exists(${path}/${SYMREF}) | |||||
_symref= ${path}/${SYMREF} | |||||
sjgUnsubmitted Not Done Inline ActionsFWIW I would use := here sjg: FWIW I would use `:=` here | |||||
.endif | |||||
.endif | |||||
.endfor | |||||
.if empty(_symref) | |||||
.error ${SYMREF} not found in the search path. | |||||
.endif | |||||
CLEANFILES+= ${SHLIB_NAME}.symbols | |||||
${SHLIB_NAME}.symbols: ${SHLIB_NAME_FULL} ${_SYMLIST} | |||||
(echo "# ${:U@}generated by bsd.lib.mk"; \ | |||||
readelf -sW ${.ALLSRC:[1]} | awk -f ${_symref} | sort ) > ${.TARGET} | |||||
.endif | |||||
.if defined(SYMBOLS_REF_MD) | |||||
_SYMBOLS_REF_ARCH= -${MACHINE_ARCH} | |||||
.else | |||||
_SYMBOLS_REF_ARCH= | |||||
.endif | |||||
SYMBOLS_REF?= ${.CURDIR}/symref${_SYMBOLS_REF_ARCH} | |||||
.if make(check-symbols) && ${.MAKE.LEVEL} == 1 | |||||
_CHECK_SYMBOLS_WARNING?= echo | |||||
.else | |||||
_CHECK_SYMBOLS_WARNING?= true | |||||
.endif | |||||
check-symbols: ${SHLIB_NAME}.symbols | |||||
@if [ ! -e ${SYMBOLS_REF} ]; then \ | |||||
${_CHECK_SYMBOLS_WARNING} "WARNING: no symbol reference (${SYMBOLS_REF:T}), run 'make update-symref'" 1>&2; \ | |||||
else \ | |||||
if ! diff ${SYMBOLS_REF} ${SHLIB_NAME}.symbols; then \ | |||||
echo "ERROR: symbol set changed, correct or run 'make update-symref'" 1>&2; \ | |||||
false; \ | |||||
fi \ | |||||
fi | |||||
update-symref: ${SHLIB_NAME}.symbols | |||||
cp ${SHLIB_NAME}.symbols ${SYMBOLS_REF} | |||||
.endif #defined(SHLIB_NAME) | .endif #defined(SHLIB_NAME) | ||||
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) | .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) | ||||
_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a | _LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a | ||||
lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} | lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} | ||||
@${ECHO} building special pic ${LIB} library | @${ECHO} building special pic ${LIB} library | ||||
@rm -f ${.TARGET} | @rm -f ${.TARGET} | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |
It is conventional to have white-space after =
same applies to all below