Skip to content

Commit

Permalink
Makefile.inc1: add LIBCOMPAT_INCLUDE_DIRS to reduce arch ifdefs
Browse files Browse the repository at this point in the history
In preparation for adding support for building lib32 on arm64,
add a list of architecture-specific include directories,
LIBCOMPAT_INCLUDE_DIRS, then replace the architecture-specific
ifdefs throughout the file with simple loops.  Another commit
will add a definition of LIBCOMPAT_INCLUDE_DIRS for aarch64.

Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D40977
  • Loading branch information
Mike Karels authored and Mike Karels committed Jul 25, 2023
1 parent dd3ad7c commit 81250b9
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions Makefile.inc1
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ _t= ${TARGET_ARCH}/${TARGET}
.endif
.endfor

.if ${TARGET_ARCH} == "amd64"
LIBCOMPAT_INCLUDE_DIRS+= i386
.endif

.if ${.MAKE.OS} != "FreeBSD"
CROSSBUILD_HOST=${.MAKE.OS}
.if ${.MAKE.OS} != "Linux" && ${.MAKE.OS} != "Darwin"
Expand Down Expand Up @@ -1081,9 +1085,9 @@ _bootstrap-tools:
-p ${WORLDTMP}/usr >/dev/null
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${WORLDTMP}/usr/include >/dev/null
.if ${TARGET_ARCH} == "amd64"
mkdir -p ${WORLDTMP}/usr/include/i386
.endif
.for d in ${LIBCOMPAT_INCLUDE_DIRS}
mkdir -p ${WORLDTMP}/usr/include/${d}
.endfor
ln -sf ${.CURDIR}/sys ${WORLDTMP}
.if ${MK_DEBUG_FILES} != "no"
${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
Expand Down Expand Up @@ -1416,9 +1420,9 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
.if ${TARGET_ARCH} == "amd64"
-mkdir ${DESTDIR}/${DISTDIR}/${dist}/usr/include/i386
.endif
.for d in ${LIBCOMPAT_INCLUDE_DIRS}
-mkdir ${DESTDIR}/${DISTDIR}/${dist}/usr/include/${d}
.endfor
.if ${MK_DEBUG_FILES} != "no"
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
Expand Down Expand Up @@ -1447,9 +1451,9 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
.if ${TARGET_ARCH} == "amd64"
echo "./${dist}/usr/include/i386 type=dir uname=root gname=wheel mode=0755" >> ${METALOG}
.endif
.for d in ${LIBCOMPAT_INCLUDE_DIRS}
echo "./${dist}/usr/include/${d} type=dir uname=root gname=wheel mode=0755" >> ${METALOG}
.endfor
.for libcompat in ${libcompats}
${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
Expand Down Expand Up @@ -2901,9 +2905,9 @@ native-xtools-install: .PHONY
-p ${NXBDESTDIR}/usr >/dev/null
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${NXBDESTDIR}/usr/include >/dev/null
.if ${TARGET_ARCH} == "amd64"
mkdir -p ${NXBDESTDIR}/usr/include/i386
.endif
.for d in ${LIBCOMPAT_INCLUDE_DIRS}
mkdir -p ${NXBDESTDIR}/usr/include/${d}
.endfor
${_+_}cd ${.CURDIR}; ${NXBMAKE} \
DESTDIR=${NXBDESTDIR} \
-DNO_ROOT \
Expand Down Expand Up @@ -3589,9 +3593,9 @@ _xi-mtree: .PHONY
-p ${XDDESTDIR}/usr >/dev/null
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${XDDESTDIR}/usr/include >/dev/null
.if ${TARGET_ARCH} == "amd64"
mkdir -p ${XDDESTDIR}/usr/include/i386
.endif
.for d in ${LIBCOMPAT_INCLUDE_DIRS}
mkdir -p ${XDDESTDIR}/usr/include/${d}
.endfor
.for libcompat in ${libcompats}
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
-p ${XDDESTDIR}/usr >/dev/null
Expand Down

0 comments on commit 81250b9

Please sign in to comment.