diff --git a/Makefile.libcompat b/Makefile.libcompat index 05e77a980b6a..11668bf54eda 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -39,6 +39,46 @@ LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \ MK_INCLUDES=no \ -DLIBRARIES_ONLY +# Shared logic +build${libcompat}: .PHONY + @echo + @echo "--------------------------------------------------------------" + @echo ">>> stage 4.3: building lib${libcompat} shim libraries" + @echo "--------------------------------------------------------------" + ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ + -p ${WORLDTMP}/usr >/dev/null +.if ${MK_DEBUG_FILES} != "no" + ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ + -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null +.endif + ${_+_}cd ${.CURDIR}; \ + WORLDTMP=${WORLDTMP} \ + MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ + ${MAKE} -f Makefile.inc1 \ + DESTDIR= \ + OBJTOP=${LIBCOMPAT_OBJTOP} \ + OBJROOT='$${OBJTOP}/' \ + MAKEOBJDIRPREFIX= \ + -DNO_LINT \ + -DNO_CPU_CFLAGS \ + MK_ASAN=no \ + MK_CTF=no \ + MK_RETPOLINE=no \ + MK_SSP=no \ + MK_UBSAN=no \ + MK_WERROR=no \ + _lc_build-tools + ${_+_}cd ${.CURDIR}; \ + ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries + +distribute${libcompat} install${libcompat}: .PHONY + ${_+_}cd ${.CURDIR}; \ + ${LIBCOMPATIMAKE} -f Makefile.inc1 _lc_${.TARGET:S/${libcompat}$//} + +# These depend on MK_*, which could vary between the native and compat +# architectures. Thus targets using them are run within a compat sub-make +# rather than the native make environment. + _LC_LIBDIRS.yes= lib _LC_LIBDIRS.yes+= gnu/lib _LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib @@ -52,46 +92,16 @@ _libmagic= lib/libmagic _jevents= lib/libpmc/pmu-events .endif - -# Shared logic -build${libcompat}: .PHONY - @echo - @echo "--------------------------------------------------------------" - @echo ">>> stage 4.3: building lib${libcompat} shim libraries" - @echo "--------------------------------------------------------------" - ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ - -p ${WORLDTMP}/usr >/dev/null -.if ${MK_DEBUG_FILES} != "no" - ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ - -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null -.endif +_lc_build-tools: .for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents} .for _t in ${_obj} build-tools - ${_+_}cd ${.CURDIR}/${_dir}; \ - WORLDTMP=${WORLDTMP} \ - MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ - ${MAKE} DESTDIR= \ - OBJTOP=${LIBCOMPAT_OBJTOP} \ - OBJROOT='$${OBJTOP}/' \ - MAKEOBJDIRPREFIX= \ - DIRPRFX=${_dir}/ \ - -DNO_LINT \ - -DNO_CPU_CFLAGS \ - MK_ASAN=no \ - MK_CTF=no \ - MK_RETPOLINE=no \ - MK_SSP=no \ - MK_UBSAN=no \ - MK_WERROR=no \ - ${_t} + ${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ ${_t} .endfor .endfor - ${_+_}cd ${.CURDIR}; \ - ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries -distribute${libcompat} install${libcompat}: .PHONY +_lc_distribute _lc_install: .for _dir in ${_LC_LIBDIRS.yes} - ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//} + ${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} ${.TARGET:S/^_lc_//} .endfor .endif # !targets(__<${_this:T}>__)