mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-29 08:08:37 +00:00
a4330302f2
Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included directly so MD paths in Makefiles work. In the process centralize setting them in LIBCOMPATWMAKEENV. Alter .PATH and CFLAGS settings in work when the Makefile is included. While here only support LIB32 on supported platforms rather than always enabling it and requiring users of MK_LIB32 to filter based TARGET/MACHINE_ARCH. The net effect of this change is to make Makefile.libcompat only build compatability libraries. Changes relative to r354449: Correct detection of the compiler type when bsd.compat.mk is used outside Makefile.libcompat. Previously it always matched the clang case. Set LDFLAGS including the linker emulation for mips where -m32 seems to be insufficent. Reviewed by: imp, kib (origional version in r354449) Obtained from: CheriBSD (conceptually) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22251
121 lines
3.6 KiB
Makefile
121 lines
3.6 KiB
Makefile
# $FreeBSD$
|
|
|
|
.if !targets(__<${_this:T}>__)
|
|
__<${_this:T}>__:
|
|
|
|
# Makefile for the compatibility libraries.
|
|
# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
|
|
|
|
.include <bsd.compat.mk>
|
|
|
|
# Yes, the flags are redundant.
|
|
LIBCOMPATWMAKEENV+= \
|
|
INSTALL="sh ${.CURDIR}/tools/install.sh" \
|
|
PATH=${TMPPATH} \
|
|
SYSROOT=${LIBCOMPATTMP} \
|
|
LIBDIR=/usr/lib${libcompat} \
|
|
SHLIBDIR=/usr/lib${libcompat} \
|
|
DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
|
|
.if ${MK_META_MODE} != "no"
|
|
# Don't rebuild build-tools targets during normal build.
|
|
LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA
|
|
.endif
|
|
LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
|
|
CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
|
|
CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
|
|
DESTDIR=${LIBCOMPATTMP} \
|
|
-DNO_CPU_CFLAGS \
|
|
MK_CTF=no \
|
|
-DNO_LINT \
|
|
MK_TESTS=no
|
|
LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
|
|
OBJTOP=${LIBCOMPAT_OBJTOP} \
|
|
OBJROOT='$${OBJTOP}/' \
|
|
MAKEOBJDIRPREFIX= \
|
|
MK_MAN=no MK_HTML=no
|
|
LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
|
|
${IMAKE_INSTALL} \
|
|
-DLIBRARIES_ONLY
|
|
|
|
_LC_LIBDIRS.yes= lib
|
|
_LC_LIBDIRS.yes+= gnu/lib
|
|
_LC_LIBDIRS.yes+= usr.bin/lex/lib
|
|
_LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib
|
|
_LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib
|
|
_LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib
|
|
|
|
_LC_INCDIRS= \
|
|
include \
|
|
lib/ncurses/ncursesw \
|
|
${_LC_LIBDIRS.yes}
|
|
|
|
.if ${MK_FILE} != "no"
|
|
_libmagic= lib/libmagic
|
|
.endif
|
|
.if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64"
|
|
_jevents= lib/libpmc/pmu-events
|
|
.endif
|
|
|
|
|
|
# Shared logic
|
|
build${libcompat}: .PHONY
|
|
@echo
|
|
@echo "--------------------------------------------------------------"
|
|
@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
|
|
@echo "--------------------------------------------------------------"
|
|
.if !defined(NO_CLEAN)
|
|
rm -rf ${LIBCOMPATTMP}
|
|
.else
|
|
${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
|
|
echo ">>> Deleting stale files in build${libcompat} tree..."; \
|
|
cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
|
|
DESTDIR=${LIBCOMPATTMP} \
|
|
delete-old delete-old-libs >/dev/null; \
|
|
fi
|
|
.endif # !defined(NO_CLEAN)
|
|
|
|
mkdir -p ${LIBCOMPATTMP}/usr/include
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
|
|
-p ${LIBCOMPATTMP}/usr >/dev/null
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
|
-p ${LIBCOMPATTMP}/usr/include >/dev/null
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
|
|
-p ${LIBCOMPATTMP}/usr >/dev/null
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
|
|
-p ${LIBCOMPATTMP}/usr/lib >/dev/null
|
|
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
|
|
-p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
|
|
.endif
|
|
mkdir -p ${WORLDTMP}
|
|
ln -sf ${.CURDIR}/sys ${WORLDTMP}
|
|
.for _t in ${_obj} includes
|
|
.for _dir in ${_LC_INCDIRS}
|
|
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
|
|
DIRPRFX=${_dir}/ ${_t}
|
|
.endfor
|
|
.endfor
|
|
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents}
|
|
.for _t in ${_obj} build-tools
|
|
${_+_}cd ${.CURDIR}/${_dir}; \
|
|
WORLDTMP=${WORLDTMP} \
|
|
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
|
|
${MAKE} SSP_CFLAGS= DESTDIR= \
|
|
OBJTOP=${LIBCOMPAT_OBJTOP} \
|
|
OBJROOT='$${OBJTOP}/' \
|
|
MAKEOBJDIRPREFIX= \
|
|
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \
|
|
MK_CTF=no MK_RETPOLINE=no MK_WARNS=no \
|
|
${_t}
|
|
.endfor
|
|
.endfor
|
|
${_+_}cd ${.CURDIR}; \
|
|
${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
|
|
|
|
distribute${libcompat} install${libcompat}: .PHONY
|
|
.for _dir in ${_LC_LIBDIRS.yes}
|
|
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
|
|
.endfor
|
|
|
|
.endif # !targets(__<${_this:T}>__)
|