Add an x86/include directory to the kernel to hold headers that are common

to amd64, i386, and pc98.  The headers are installed to /usr/include/x86
during an installworld, and an 'x86' symlink is created for kernel builds
similar to 'machine' so that the headers can be included as <x86/foo.h>.

Reviewed by:	imp
This commit is contained in:
John Baldwin 2010-11-01 17:34:04 +00:00
parent 95a68ec69c
commit 544de89de0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=214629
3 changed files with 22 additions and 9 deletions

View File

@ -116,7 +116,10 @@ INCSLINKS+= sys/$i ${INCLUDEDIR}/$i
.endfor .endfor
.if ${MACHINE} != ${MACHINE_CPUARCH} .if ${MACHINE} != ${MACHINE_CPUARCH}
_MARCH=${MACHINE_CPUARCH} _MARCHS= ${MACHINE_CPUARCH}
.endif
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
_MARCHS+= x86
.endif .endif
.include <bsd.prog.mk> .include <bsd.prog.mk>
@ -126,7 +129,7 @@ ${SHARED}: compat
# Take care of stale directory-level symlinks. # Take care of stale directory-level symlinks.
compat: compat:
.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto .for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
fi fi
@ -142,7 +145,7 @@ compat:
copies: copies:
.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \ .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
${_MARCH} ${_MARCHS}
.if exists(${DESTDIR}${INCLUDEDIR}/$i) .if exists(${DESTDIR}${INCLUDEDIR}/$i)
cd ${DESTDIR}${INCLUDEDIR}/$i; \ cd ${DESTDIR}${INCLUDEDIR}/$i; \
for h in *.h; do \ for h in *.h; do \
@ -189,7 +192,8 @@ copies:
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
${DESTDIR}${INCLUDEDIR}/machine/pc ${DESTDIR}${INCLUDEDIR}/machine/pc
.endif .endif
.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) .for _MARCH in ${_MARCHS}
.if exists(${.CURDIR}/../sys/${_MARCH}/include)
${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
cd ${.CURDIR}/../sys/${_MARCH}/include; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \
@ -203,6 +207,7 @@ copies:
${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
.endif .endif
.endif .endif
.endfor
cd ${.CURDIR}/../sys/rpc; \ cd ${.CURDIR}/../sys/rpc; \
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
${DESTDIR}${INCLUDEDIR}/rpc ${DESTDIR}${INCLUDEDIR}/rpc
@ -276,7 +281,8 @@ symlinks:
${DESTDIR}${INCLUDEDIR}/machine/pc; \ ${DESTDIR}${INCLUDEDIR}/machine/pc; \
done done
.endif .endif
.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) .for _MARCH in ${_MARCHS}
.if exists(${.CURDIR}/../sys/${_MARCH}/include)
${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
cd ${.CURDIR}/../sys/${_MARCH}/include; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \
@ -294,6 +300,7 @@ symlinks:
done done
.endif .endif
.endif .endif
.endfor
cd ${.CURDIR}/../sys/fs/cd9660; \ cd ${.CURDIR}/../sys/fs/cd9660; \
for h in *.h; do \ for h in *.h; do \
ln -fs ../../../../sys/fs/cd9660/$$h \ ln -fs ../../../../sys/fs/cd9660/$$h \

View File

@ -169,6 +169,9 @@ _ILINKS= machine
.if ${MACHINE} != ${MACHINE_CPUARCH} .if ${MACHINE} != ${MACHINE_CPUARCH}
_ILINKS+= ${MACHINE_CPUARCH} _ILINKS+= ${MACHINE_CPUARCH}
.endif .endif
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
_ILINKS+= x86
.endif
# Ensure that the link exists without depending on it when it exists. # Ensure that the link exists without depending on it when it exists.
.for _link in ${_ILINKS} .for _link in ${_ILINKS}
@ -181,8 +184,8 @@ ${_ILINKS}:
@case ${.TARGET} in \ @case ${.TARGET} in \
machine) \ machine) \
path=${S}/${MACHINE}/include ;; \ path=${S}/${MACHINE}/include ;; \
${MACHINE_CPUARCH}) \ *) \
path=${S}/${MACHINE_CPUARCH}/include ;; \ path=${S}/${.TARGET}/include ;; \
esac ; \ esac ; \
${ECHO} ${.TARGET} "->" $$path ; \ ${ECHO} ${.TARGET} "->" $$path ; \
ln -s $$path ${.TARGET} ln -s $$path ${.TARGET}

View File

@ -238,6 +238,9 @@ _ILINKS=@ machine
.if ${MACHINE} != ${MACHINE_CPUARCH} .if ${MACHINE} != ${MACHINE_CPUARCH}
_ILINKS+=${MACHINE_CPUARCH} _ILINKS+=${MACHINE_CPUARCH}
.endif .endif
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
_ILINKS+=x86
.endif
all: objwarn ${PROG} all: objwarn ${PROG}
@ -263,12 +266,12 @@ SYSDIR= ${_dir}
${_ILINKS}: ${_ILINKS}:
@case ${.TARGET} in \ @case ${.TARGET} in \
${MACHINE_CPUARCH}) \
path=${SYSDIR}/${MACHINE_CPUARCH}/include ;; \
machine) \ machine) \
path=${SYSDIR}/${MACHINE}/include ;; \ path=${SYSDIR}/${MACHINE}/include ;; \
@) \ @) \
path=${SYSDIR} ;; \ path=${SYSDIR} ;; \
*) \
path=${SYSDIR}/${.TARGET}/include ;; \
esac ; \ esac ; \
path=`(cd $$path && /bin/pwd)` ; \ path=`(cd $$path && /bin/pwd)` ; \
${ECHO} ${.TARGET} "->" $$path ; \ ${ECHO} ${.TARGET} "->" $$path ; \