From nobody Tue Jun 27 23:11:54 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QrL7t5tK0z4kXNV; Tue, 27 Jun 2023 23:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QrL7t5XkJz4JQ7; Tue, 27 Jun 2023 23:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687907514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3VarNxY2pgH4DXqOW5ry08krZ48axcbBbEFFqaXENwU=; b=dEJ11ML9Qk0oED6afTTqoN2D9pC4r4Eq1JTu+N69mPQMLunTguFlE5G6V79hAla66pAaoU nUwMrPufE2cJvZjyJFfUXcZVgOLvk/hd0Z/dcOHTl33scQOuMoKNCwssj0WYaTlPii9z+T dcb+YxY5kw4cLDRcdArkg8t6e0tXQNZ0CyGa0MTtBgrgxqvv9+Q9U/8iIQxgXKmrkqn+1y zUTc9RkBDVxJywF1KjN4Nq9SdhVJh33pn/ca/dRgVKAtKF8Emv8lpmbLPOIhkHVTqevuoF wSna9X8Vpr8lD9CtBV/WUSxosULcx38WYpvUa4dbaudK0lpSQwxpfGTNHh7iZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687907514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3VarNxY2pgH4DXqOW5ry08krZ48axcbBbEFFqaXENwU=; b=tExk6DE3wfsZ4lMayW/qyORrKdzKwG31wfr1MG3p9RM6LZFdmLNrLvqxTdZl/ZSPw/5jvY aogxSVX70htV1hVL2yzcttak59N6LVahvqgJPfJR5M3JjOB34ZtZ0bgHorah8h3n59Nlla dMAjgsW8yIxDxzMwKU4RvxCZqkf/FQfvjLDIIVQqQuhjL7JjCGUsK3LUi79x9WkWxVwe7T e5eI1531mMRy5sLoPRK7NP/DuNouUQhf4Zi9IIoKi1wnF5Xyi8+yqzXvUnYMY0cJ7di4nS 7h4f2SgpxHGyYtdaU5a0BMStZf/J40koIY9Hqr0UOl46fLXLFen4KQiCXC82jw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687907514; a=rsa-sha256; cv=none; b=Yhqt2jLepnAQOsCYhNYMNX9nIxUGHT5dwO3XjIuZvSLOQsml2XvdYs0a+TafK3rnLWz3uw yXEMRwpDu4PvI06bMtTLW5oXdXMs9rWFBHdmDUUtb9w9MISSBdTCDxdKK1TTtIhgemhv9/ QT7GNjBHXUNvoGXrHXeJOlMKs6eaYnNYwQwoz95cVL7gItRPgol1KWs/YAqzMvjXs5snPT 95kV82Vr6qvtKl1wtPH0PcmW2fdHpD/57210e+7zu0n3qJ4FgDZBqPK0jA682XSXc2U+N+ Ul0lF+04vSA1/dOu1cJA89IrwWd49BpmwMycauS4hGGUxw2zrE9hzs3QpKKPVw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QrL7t4dp9z19Vp; Tue, 27 Jun 2023 23:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35RNBshv009005; Tue, 27 Jun 2023 23:11:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35RNBsh1009004; Tue, 27 Jun 2023 23:11:54 GMT (envelope-from git) Date: Tue, 27 Jun 2023 23:11:54 GMT Message-Id: <202306272311.35RNBsh1009004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 91d7edd549f5 - main - Generalise libcompat to be a list rather than a single option List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91d7edd549f52d09dbb12ecf5f0cf2298287f1c8 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=91d7edd549f52d09dbb12ecf5f0cf2298287f1c8 commit 91d7edd549f52d09dbb12ecf5f0cf2298287f1c8 Author: Jessica Clarke AuthorDate: 2023-06-27 23:10:49 +0000 Commit: Jessica Clarke CommitDate: 2023-06-27 23:10:49 +0000 Generalise libcompat to be a list rather than a single option Whilst the kernel can support any number of COMPAT_FOO, world can only build a single libfoo. Upstream this isn't such an issue, since the only option is lib32 anyway, but downstreams, such as CheriBSD, may wish to support multiple at the same time. Thus, adjust the top-level Makefiles to turn _LIBCOMPAT into a _LIBCOMPATS list that gets iterated over, and adjust bsd.compat.mk to support this use-case. For the normal NEED_COMPAT/WANT_COMPAT case, LIBCOMPATFOO remain set and refer to the requested compat's, preserving the current interface. For the top-level Makefiles those variables are no longer set (since there is no longer "the" compat) and only the per-compat ones are available. Reviewed by: brooks, jhb, imp Differential Revision: https://reviews.freebsd.org/D40571 --- Makefile.inc1 | 42 +++++++++++++++--------------- Makefile.libcompat | 33 +++++++++++++++--------- share/mk/bsd.compat.mk | 69 ++++++++++++++++++++++++++++++-------------------- 3 files changed, 84 insertions(+), 60 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 68b1a22c1365..6db68b627d96 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -852,9 +852,9 @@ XCFLAGS+= ${BFLAGS} .endif .if ${MK_LIB32} == "yes" -_LIBCOMPAT= 32 -.include "Makefile.libcompat" +_LIBCOMPATS+= 32 .endif +.include "Makefile.libcompat" # META_MODE normally ignores host file changes since every build updates # timestamps (see NO_META_IGNORE_HOST in sys.mk). There are known times @@ -1100,9 +1100,9 @@ _cleanobj: # Avoid including bsd.compiler.mk in clean and obj with _NO_INCLUDE_COMPILERMK # since the restricted $PATH might not contain a valid cc binary ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR} -.if defined(_LIBCOMPAT) - ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR} -.endif +.for LIBCOMPAT in ${_LIBCOMPATS} + ${_+_}cd ${.CURDIR}; ${LIB${LIBCOMPAT}WMAKE} _NO_INCLUDE_COMPILERMK=t -f Makefile.inc1 ${CLEANDIR} +.endfor .else ${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t _cleanobj_fast_depend_hack .endif # ${MK_CLEAN} == "yes" @@ -1179,8 +1179,10 @@ WMAKE_TGTS+= _includes .if !defined(NO_LIBS) WMAKE_TGTS+= _libraries .endif -.if defined(_LIBCOMPAT) && empty(SUBDIR_OVERRIDE) +.if empty(SUBDIR_OVERRIDE) +.for libcompat in ${libcompats} WMAKE_TGTS+= build${libcompat} +.endfor .endif WMAKE_TGTS+= everything @@ -1241,7 +1243,7 @@ buildenv: .PHONY INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}" \ MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}" BUILDENV=1 ${BUILDENV_SHELL} -TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} +TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:${libcompats:@v@Nbuild${v}@:ts:}} toolchain: ${TOOLCHAIN_TGTS} .PHONY KERNEL_TOOLCHAIN_TGTS= ${TOOLCHAIN_TGTS:N_obj:N_cleanobj:N_includes:N_libraries} .if make(kernel-toolchain) @@ -1362,9 +1364,9 @@ ITOOLS+=${LOCAL_ITOOLS} # Non-base distributions produced by the base system EXTRA_DISTRIBUTIONS= -.if defined(_LIBCOMPAT) +.for libcompat in ${libcompats} EXTRA_DISTRIBUTIONS+= lib${libcompat} -.endif +.endfor .if ${MK_TESTS} != "no" EXTRA_DISTRIBUTIONS+= tests .endif @@ -1420,14 +1422,14 @@ distributeworld installworld stageworld: _installcheck_world .PHONY ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null .endif -.if defined(_LIBCOMPAT) +.for libcompat in ${libcompats} ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null .if ${MK_DEBUG_FILES} != "no" ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null .endif -.endif +.endfor .if ${MK_TESTS} != "no" && ${dist} == "tests" -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ @@ -1447,10 +1449,10 @@ distributeworld installworld stageworld: _installcheck_world .PHONY .if ${TARGET_ARCH} == "amd64" echo "./${dist}/usr/include/i386 type=dir uname=root gname=wheel mode=0755" >> ${METALOG} .endif -.if defined(_LIBCOMPAT) +.for libcompat in ${libcompats} ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} -.endif +.endfor .endif .endfor -mkdir ${DESTDIR}/${DISTDIR}/base @@ -1579,9 +1581,9 @@ restage reinstall: .MAKE .PHONY @echo ">>> Installing everything started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install -.if defined(_LIBCOMPAT) +.for libcompat in ${libcompats} ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} -.endif +.endfor @echo "--------------------------------------------------------------" @echo ">>> Installing everything completed on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @@ -1591,10 +1593,10 @@ redistribute: .MAKE .PHONY @echo ">>> Distributing everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute -.if defined(_LIBCOMPAT) +.for libcompat in ${libcompats} ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ DISTRIBUTION=lib${libcompat} -.endif +.endfor distrib-dirs distribution: .MAKE .PHONY ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \ @@ -1678,7 +1680,7 @@ _cleankernobj_fast_depend_hack: .PHONY .endfor .endif -${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY +${WMAKE_TGTS:N_worldtmp:${libcompats:@v@Nbuild${v}@:ts:}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY # record kernel(s) build time in seconds .if make(buildkernel) @@ -3589,10 +3591,10 @@ _xi-mtree: .PHONY .if ${TARGET_ARCH} == "amd64" mkdir -p ${XDDESTDIR}/usr/include/i386 .endif -.if defined(_LIBCOMPAT) +.for libcompat in ${libcompats} ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ -p ${XDDESTDIR}/usr >/dev/null -.endif +.endfor .if ${MK_TESTS} != "no" mkdir -p ${XDDESTDIR}${TESTSBASE} ${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ diff --git a/Makefile.libcompat b/Makefile.libcompat index 11668bf54eda..4bcb7479270c 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -6,10 +6,14 @@ __<${_this:T}>__: # Makefile for the compatibility libraries. # - 32-bit compat libraries on PowerPC, and AMD64. +.if defined(_LIBCOMPATS) + .include +.for libcompatidx _LIBCOMPAT libcompat in ${_LIBCOMPATS:range:@i@${i} ${_LIBCOMPATS:[$i]} ${libcompats:[$i]}@} + # Yes, the flags are redundant. -LIBCOMPATWMAKEENV+= \ +LIB${_LIBCOMPAT}WMAKEENV+= \ INSTALL="${INSTALL_CMD} -U" \ PATH=${TMPPATH} \ SYSROOT=${WORLDTMP} \ @@ -19,22 +23,23 @@ LIBCOMPATWMAKEENV+= \ DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}" .if ${MK_META_MODE} != "no" # Don't rebuild build-tools targets during normal build. -LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA +LIB${_LIBCOMPAT}WMAKEENV+= BUILD_TOOLS_META=.NOMETA .endif -LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \ - CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \ - CPP="${XCPP} ${LIBCOMPATCFLAGS}" \ +LIB${_LIBCOMPAT}WMAKEFLAGS+= CC="${XCC} ${LIB${_LIBCOMPAT}CFLAGS}" \ + CXX="${XCXX} ${LIB${_LIBCOMPAT}CXXFLAGS} ${LIB${_LIBCOMPAT}CFLAGS}" \ + CPP="${XCPP} ${LIB${_LIBCOMPAT}CFLAGS}" \ DESTDIR=${WORLDTMP} \ -DNO_CPU_CFLAGS \ MK_BOOT=no \ MK_CTF=no \ MK_TESTS=no -LIBCOMPATWMAKE+= ${TIME_ENV} ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \ - OBJTOP=${LIBCOMPAT_OBJTOP} \ +LIB${_LIBCOMPAT}WMAKE+= ${TIME_ENV} ${LIB${_LIBCOMPAT}WMAKEENV} ${MAKE} \ + ${LIB${_LIBCOMPAT}WMAKEFLAGS} \ + OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ MK_MAN=no MK_HTML=no -LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \ +LIB${_LIBCOMPAT}IMAKE+= ${LIB${_LIBCOMPAT}WMAKE:NINSTALL=*:NDESTDIR=*} \ ${IMAKE_INSTALL} \ MK_INCLUDES=no \ -DLIBRARIES_ONLY @@ -43,7 +48,7 @@ LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \ build${libcompat}: .PHONY @echo @echo "--------------------------------------------------------------" - @echo ">>> stage 4.3: building lib${libcompat} shim libraries" + @echo ">>> stage 4.3.${libcompatidx}: building lib${libcompat} shim libraries" @echo "--------------------------------------------------------------" ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ -p ${WORLDTMP}/usr >/dev/null @@ -56,7 +61,7 @@ build${libcompat}: .PHONY MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ ${MAKE} -f Makefile.inc1 \ DESTDIR= \ - OBJTOP=${LIBCOMPAT_OBJTOP} \ + OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ -DNO_LINT \ @@ -69,11 +74,15 @@ build${libcompat}: .PHONY MK_WERROR=no \ _lc_build-tools ${_+_}cd ${.CURDIR}; \ - ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries + ${LIB${_LIBCOMPAT}WMAKE} -f Makefile.inc1 -DNO_FSCHG libraries distribute${libcompat} install${libcompat}: .PHONY ${_+_}cd ${.CURDIR}; \ - ${LIBCOMPATIMAKE} -f Makefile.inc1 _lc_${.TARGET:S/${libcompat}$//} + ${LIB${_LIBCOMPAT}IMAKE} -f Makefile.inc1 _lc_${.TARGET:S/${libcompat}$//} + +.endfor # libcompatidx _LIBCOMPAT libcompat + +.endif # defined(_LIBCOMPATS) # These depend on MK_*, which could vary between the native and compat # architectures. Thus targets using them are run within a compat sub-make diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index aabfd6a06192..388a687e695b 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -3,9 +3,13 @@ .if !targets(__<${_this:T}>__) __<${_this:T}>__: -.if defined(_LIBCOMPAT) +_ALL_LIBCOMPATS:= 32 + +.if defined(_LIBCOMPATS) COMPAT_ARCH?= ${TARGET_ARCH} -COMPAT_CPUTYPE?= ${CPUTYPE_${_LIBCOMPAT}} +.for _LIBCOMPAT in ${_ALL_LIBCOMPATS} +LIB${_LIBCOMPAT}CPUTYPE?= ${CPUTYPE_${_LIBCOMPAT}} +.endfor .if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) COMPAT_COMPILER_TYPE= gcc @@ -14,7 +18,9 @@ COMPAT_COMPILER_TYPE= clang .endif .else COMPAT_ARCH= ${MACHINE_ARCH} -COMPAT_CPUTYPE= ${CPUTYPE} +.for _LIBCOMPAT in ${_ALL_LIBCOMPATS} +LIB${_LIBCOMPAT}CPUTYPE= ${CPUTYPE} +.endfor .include COMPAT_COMPILER_TYPE=${COMPILER_TYPE} .endif @@ -22,11 +28,11 @@ COMPAT_COMPILER_TYPE=${COMPILER_TYPE} # ------------------------------------------------------------------- # 32 bit world .if ${COMPAT_ARCH} == "amd64" -HAS_COMPAT=32 -.if empty(COMPAT_CPUTYPE) +HAS_COMPAT+= 32 +.if empty(LIB32CPUTYPE) LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else -LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} +LIB32CPUFLAGS= -march=${LIB32CPUTYPE} .endif .if ${COMPAT_COMPILER_TYPE} == gcc .else @@ -40,11 +46,11 @@ LIB32WMAKEFLAGS= \ LD="${XLD} -m elf_i386_fbsd" .elif ${COMPAT_ARCH} == "powerpc64" -HAS_COMPAT=32 -.if empty(COMPAT_CPUTYPE) +HAS_COMPAT+= 32 +.if empty(LIB32CPUTYPE) LIB32CPUFLAGS= -mcpu=powerpc .else -LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} +LIB32CPUFLAGS= -mcpu=${LIB32CPUTYPE} .endif .if ${COMPAT_COMPILER_TYPE} == "gcc" @@ -89,43 +95,50 @@ WANT_COMPAT:= ${NEED_COMPAT} .if defined(HAS_COMPAT) && defined(WANT_COMPAT) .if ${WANT_COMPAT} == "any" -_LIBCOMPAT:= ${HAS_COMPAT:[1]} +USE_COMPAT:= ${HAS_COMPAT:[1]} .else -_LIBCOMPAT:= ${WANT_COMPAT} +USE_COMPAT:= ${WANT_COMPAT} .endif + +_LIBCOMPATS= ${USE_COMPAT} .endif +libcompats= ${_LIBCOMPATS:tl} + # ------------------------------------------------------------------- # Generic code for each type. # Set defaults based on type. -libcompat= ${_LIBCOMPAT:tl} -_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \ - _MACHINE _MACHINE_ARCH _MACHINE_ABI \ - WMAKEENV WMAKEFLAGS WMAKE WORLDTMP -.for _var in ${_LIBCOMPAT_MAKEVARS} -.if !empty(LIB${_LIBCOMPAT}${_var}) -LIBCOMPAT${_var}?= ${LIB${_LIBCOMPAT}${_var}} -.endif -.endfor - +.for _LIBCOMPAT _libcompat in ${_LIBCOMPATS:@v@${v} ${v:tl}@} WORLDTMP?= ${SYSROOT} # Shared flags -LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat} +LIB${_LIBCOMPAT}_OBJTOP?= ${OBJTOP}/obj-lib${_libcompat} -LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ +LIB${_LIBCOMPAT}CFLAGS+= ${LIB${_LIBCOMPAT}CPUFLAGS} \ --sysroot=${WORLDTMP} \ ${BFLAGS} -LIBCOMPATLDFLAGS+= -L${WORLDTMP}/usr/lib${libcompat} +LIB${_LIBCOMPAT}LDFLAGS+= -L${WORLDTMP}/usr/lib${_libcompat} -LIBCOMPATWMAKEENV+= MACHINE=${LIBCOMPAT_MACHINE} -LIBCOMPATWMAKEENV+= MACHINE_ARCH=${LIBCOMPAT_MACHINE_ARCH} +LIB${_LIBCOMPAT}WMAKEENV+= MACHINE=${LIB${_LIBCOMPAT}_MACHINE} +LIB${_LIBCOMPAT}WMAKEENV+= MACHINE_ARCH=${LIB${_LIBCOMPAT}_MACHINE_ARCH} # -B is needed to find /usr/lib32/crti.o for gcc. -LIBCOMPATCFLAGS+= -B${WORLDTMP}/usr/lib${libcompat} +LIB${_LIBCOMPAT}CFLAGS+= -B${WORLDTMP}/usr/lib${_libcompat} +.endfor + +.if defined(USE_COMPAT) +libcompat= ${USE_COMPAT:tl} + +_LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \ + _MACHINE _MACHINE_ARCH _MACHINE_ABI \ + WMAKEENV WMAKEFLAGS WMAKE WORLDTMP +.for _var in ${_LIBCOMPAT_MAKEVARS} +.if !empty(LIB${USE_COMPAT}${_var}) +LIBCOMPAT${_var}?= ${LIB${USE_COMPAT}${_var}} +.endif +.endfor -.if defined(WANT_COMPAT) LIBDIR_BASE:= /usr/lib${libcompat} LIBDATADIR:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP}