Add support for host32 for DIRDEPS_BUILD
Allow building 32bit libs for host. Move CFLAGS additions from local.sys.dirdeps.mk (which is too early and impacts CFLAGS defaults) to local.sys.mk Reviewed by: stevek Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D41946
This commit is contained in:
+32
-12
@@ -1,32 +1,40 @@
|
|||||||
# RCSid:
|
# RCSid:
|
||||||
# $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $
|
# $Id: host-target.mk,v 1.19 2023/09/21 06:44:53 sjg Exp $
|
||||||
|
|
||||||
# Host platform information; may be overridden
|
# Host platform information; may be overridden
|
||||||
|
.if !target(__${.PARSEFILE}__)
|
||||||
|
__${.PARSEFILE}__: .NOTMAIN
|
||||||
|
|
||||||
.if !defined(_HOST_OSNAME)
|
.if !defined(_HOST_OSNAME)
|
||||||
_HOST_OSNAME != uname -s
|
# use .MAKE.OS if available
|
||||||
|
_HOST_OSNAME := ${.MAKE.OS:U${uname -s:L:sh}}
|
||||||
.export _HOST_OSNAME
|
.export _HOST_OSNAME
|
||||||
.endif
|
.endif
|
||||||
.if !defined(_HOST_OSREL)
|
.if !defined(_HOST_OSREL)
|
||||||
_HOST_OSREL != uname -r
|
_HOST_OSREL != uname -r
|
||||||
.export _HOST_OSREL
|
.export _HOST_OSREL
|
||||||
.endif
|
.endif
|
||||||
.if !defined(_HOST_MACHINE)
|
|
||||||
_HOST_MACHINE != uname -m
|
|
||||||
.export _HOST_MACHINE
|
|
||||||
.endif
|
|
||||||
.if !defined(_HOST_ARCH)
|
.if !defined(_HOST_ARCH)
|
||||||
# for NetBSD prefer $MACHINE (amd64 rather than x86_64)
|
|
||||||
.if ${_HOST_OSNAME:NNetBSD} == ""
|
|
||||||
_HOST_ARCH := ${_HOST_MACHINE}
|
|
||||||
.else
|
|
||||||
_HOST_ARCH != uname -p 2> /dev/null || uname -m
|
_HOST_ARCH != uname -p 2> /dev/null || uname -m
|
||||||
# uname -p may produce garbage on linux
|
# uname -p may produce garbage on linux
|
||||||
.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
|
.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
|
||||||
_HOST_ARCH := ${_HOST_MACHINE}
|
_HOST_ARCH = ${_HOST_MACHINE}
|
||||||
.endif
|
.elif ${_HOST_OSNAME:NDarwin} == "" && ${_HOST_ARCH:Narm:Ni386} == ""
|
||||||
|
# _HOST_MACHINE is more explicit/useful
|
||||||
|
_HOST_ARCH = ${_HOST_MACHINE}
|
||||||
.endif
|
.endif
|
||||||
.export _HOST_ARCH
|
.export _HOST_ARCH
|
||||||
.endif
|
.endif
|
||||||
|
.if !defined(_HOST_MACHINE)
|
||||||
|
_HOST_MACHINE != uname -m
|
||||||
|
# just in case
|
||||||
|
_HOST_ARCH := ${_HOST_ARCH}
|
||||||
|
# uname -m may produce garbage on darwin ppc
|
||||||
|
.if ${_HOST_MACHINE:[\#]} > 1
|
||||||
|
_HOST_MACHINE := ${_HOST_ARCH}
|
||||||
|
.endif
|
||||||
|
.export _HOST_MACHINE
|
||||||
|
.endif
|
||||||
.if !defined(HOST_MACHINE)
|
.if !defined(HOST_MACHINE)
|
||||||
HOST_MACHINE := ${_HOST_MACHINE}
|
HOST_MACHINE := ${_HOST_MACHINE}
|
||||||
.export HOST_MACHINE
|
.export HOST_MACHINE
|
||||||
@@ -37,8 +45,20 @@ HOST_OSTYPE := ${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARC
|
|||||||
HOST_OS := ${_HOST_OSNAME}
|
HOST_OS := ${_HOST_OSNAME}
|
||||||
host_os := ${_HOST_OSNAME:tl}
|
host_os := ${_HOST_OSNAME:tl}
|
||||||
HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}
|
HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}
|
||||||
|
# sometimes we want HOST_TARGET32
|
||||||
|
MACHINE32.amd64 = i386
|
||||||
|
MACHINE32.x86_64 = i386
|
||||||
|
.if !defined(_HOST_ARCH32)
|
||||||
|
_HOST_ARCH32 := ${MACHINE32.${_HOST_ARCH}:U${_HOST_ARCH:S,64$,,}}
|
||||||
|
.export _HOST_ARCH32
|
||||||
|
.endif
|
||||||
|
HOST_TARGET32 := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH32}
|
||||||
|
|
||||||
|
.export HOST_TARGET HOST_TARGET32
|
||||||
|
|
||||||
# tr is insanely non-portable, accommodate the lowest common denominator
|
# tr is insanely non-portable, accommodate the lowest common denominator
|
||||||
TR ?= tr
|
TR ?= tr
|
||||||
toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
|
toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
|
||||||
toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ DIRDEPS_FILTER.host = \
|
|||||||
Ninclude* \
|
Ninclude* \
|
||||||
Nlib/csu* \
|
Nlib/csu* \
|
||||||
Nlib/libc \
|
Nlib/libc \
|
||||||
|
Nlib/libcompiler_rt \
|
||||||
Nlib/[mn]* \
|
Nlib/[mn]* \
|
||||||
|
Nlib/lib[t]* \
|
||||||
Ngnu/lib/lib[a-r]* \
|
Ngnu/lib/lib[a-r]* \
|
||||||
Nsecure/lib* \
|
Nsecure/lib* \
|
||||||
Nusr.bin/xinstall* \
|
Nusr.bin/xinstall* \
|
||||||
@@ -50,6 +52,8 @@ N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToS
|
|||||||
DIRDEPS_FILTER.host+= ${N_host_libs}
|
DIRDEPS_FILTER.host+= ${N_host_libs}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
DIRDEPS_FILTER.host32 = ${DIRDEPS_FILTER.host}
|
||||||
|
|
||||||
DIRDEPS_FILTER+= \
|
DIRDEPS_FILTER+= \
|
||||||
Nbin/cat.host \
|
Nbin/cat.host \
|
||||||
${DIRDEPS_FILTER.xtras:U}
|
${DIRDEPS_FILTER.xtras:U}
|
||||||
@@ -107,6 +111,7 @@ DIRDEPS += \
|
|||||||
cddl/usr.bin/ctfmerge.host
|
cddl/usr.bin/ctfmerge.host
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if ${DEP_MACHINE:Nhost*} != ""
|
||||||
# Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed.
|
# Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed.
|
||||||
# Add both gcc_s and gcc_eh as dependencies as the decision to build
|
# Add both gcc_s and gcc_eh as dependencies as the decision to build
|
||||||
# -static or not is not known here.
|
# -static or not is not known here.
|
||||||
@@ -115,6 +120,7 @@ DIRDEPS+= \
|
|||||||
lib/libgcc_eh \
|
lib/libgcc_eh \
|
||||||
lib/libgcc_s
|
lib/libgcc_s
|
||||||
.endif
|
.endif
|
||||||
|
.endif
|
||||||
|
|
||||||
# Bootstrap support. Give hints to DIRDEPS if there is no Makefile.depend*
|
# Bootstrap support. Give hints to DIRDEPS if there is no Makefile.depend*
|
||||||
# generated yet. This can be based on things such as SRC files and LIBADD.
|
# generated yet. This can be based on things such as SRC files and LIBADD.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ __${_this}__:
|
|||||||
|
|
||||||
# XXX: This should be combined with external compiler support in Makefile.inc1
|
# XXX: This should be combined with external compiler support in Makefile.inc1
|
||||||
# and local.meta.sys.mk (CROSS_TARGET_FLAGS)
|
# and local.meta.sys.mk (CROSS_TARGET_FLAGS)
|
||||||
.if ${MK_SYSROOT} == "yes" && !empty(SYSROOT) && ${MACHINE} != "host"
|
.if ${MK_SYSROOT} == "yes" && !empty(SYSROOT) && ${MACHINE:Nhost*} != ""
|
||||||
CFLAGS_LAST+= --sysroot=${SYSROOT}
|
CFLAGS_LAST+= --sysroot=${SYSROOT}
|
||||||
CXXFLAGS_LAST+= --sysroot=${SYSROOT}
|
CXXFLAGS_LAST+= --sysroot=${SYSROOT}
|
||||||
LDADD+= --sysroot=${SYSROOT}
|
LDADD+= --sysroot=${SYSROOT}
|
||||||
@@ -29,8 +29,8 @@ CFLAGS+= -isystem${ISYSTEM}
|
|||||||
LDADD+= -L${STAGE_LIBDIR}
|
LDADD+= -L${STAGE_LIBDIR}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MACHINE} == "host"
|
.if ${MACHINE:Nhost*} == ""
|
||||||
.if ${.MAKE.DEPENDFILE:E} != "host"
|
.if ${.MAKE.DEPENDFILE:E:Nhost*} != ""
|
||||||
UPDATE_DEPENDFILE?= no
|
UPDATE_DEPENDFILE?= no
|
||||||
.endif
|
.endif
|
||||||
HOST_CFLAGS+= -DHOSTPROG
|
HOST_CFLAGS+= -DHOSTPROG
|
||||||
|
|||||||
@@ -24,17 +24,28 @@ BOOT_MACHINE_DIR.$m ?= stand/$m
|
|||||||
.endfor
|
.endfor
|
||||||
|
|
||||||
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
|
||||||
|
HOST_OBJTOP32 ?= ${OBJROOT}${HOST_TARGET32}
|
||||||
|
|
||||||
|
.if ${.MAKE.LEVEL} == 0
|
||||||
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
|
||||||
MACHINE= host
|
MACHINE= host
|
||||||
.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
|
.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
|
||||||
# not what we want
|
# not what we want
|
||||||
TARGET_MACHINE= host
|
TARGET_MACHINE= host
|
||||||
.endif
|
.endif
|
||||||
|
.elif ${REQUESTED_MACHINE:U${MACHINE}} == "host32"
|
||||||
|
MACHINE= host32
|
||||||
.endif
|
.endif
|
||||||
.if ${MACHINE} == "host"
|
.endif
|
||||||
OBJTOP := ${HOST_OBJTOP}
|
|
||||||
|
.if ${MACHINE:Nhost*} == ""
|
||||||
MACHINE_ARCH= ${MACHINE_ARCH_${MACHINE}}
|
MACHINE_ARCH= ${MACHINE_ARCH_${MACHINE}}
|
||||||
|
.if ${MACHINE} == "host32"
|
||||||
|
.MAKE.DEPENDFILE_PREFERENCE= \
|
||||||
|
${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.host32 \
|
||||||
|
${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.host \
|
||||||
|
${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}
|
||||||
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ LDFLAGS_LAST+= -L${STAGE_LIBDIR}
|
|||||||
|
|
||||||
.-include "local.toolchain.mk"
|
.-include "local.toolchain.mk"
|
||||||
|
|
||||||
.if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host"
|
.if ${.MAKE.LEVEL} > 0 && ${MACHINE:Nhost*} == "" && ${.MAKE.DEPENDFILE:E} != "${MACHINE}"
|
||||||
# we can use this but should not update it.
|
# we can use this but should not update it.
|
||||||
UPDATE_DEPENDFILE?= NO
|
UPDATE_DEPENDFILE?= NO
|
||||||
.endif
|
.endif
|
||||||
@@ -115,16 +115,10 @@ ${var}= ${HOST_${var}}
|
|||||||
.endfor
|
.endfor
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
|
|
||||||
# cross-building
|
|
||||||
.if !defined(FREEBSD_REVISION)
|
.if !defined(FREEBSD_REVISION)
|
||||||
FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
|
FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
|
||||||
.export FREEBSD_REVISION
|
.export FREEBSD_REVISION
|
||||||
.endif
|
.endif
|
||||||
CROSS_TARGET_FLAGS?= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
|
|
||||||
CFLAGS+= ${CROSS_TARGET_FLAGS}
|
|
||||||
ACFLAGS+= ${CROSS_TARGET_FLAGS}
|
|
||||||
.endif
|
|
||||||
|
|
||||||
# we set these here, rather than local.gendirdeps.mk
|
# we set these here, rather than local.gendirdeps.mk
|
||||||
# so we can ensure any DEP_* values that might be used in
|
# so we can ensure any DEP_* values that might be used in
|
||||||
@@ -150,7 +144,7 @@ $V?= ${${V:S,DEP_,,}}
|
|||||||
.endfor
|
.endfor
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MACHINE} == "host" && ${.MAKE.OS} != "FreeBSD"
|
.if ${MACHINE:Nhost*} == "" && ${.MAKE.OS} != "FreeBSD"
|
||||||
# some makefiles expect this
|
# some makefiles expect this
|
||||||
BOOTSTRAPPING= 0
|
BOOTSTRAPPING= 0
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
|
||||||
.-include <site.sys.machine.mk>
|
.-include <site.sys.machine.mk>
|
||||||
|
|
||||||
PSEUDO_MACHINE_LIST?= common host
|
PSEUDO_MACHINE_LIST?= common host host32
|
||||||
TARGET_MACHINE_LIST?= amd64 arm arm64 i386 powerpc riscv
|
TARGET_MACHINE_LIST?= amd64 arm arm64 i386 powerpc riscv
|
||||||
|
|
||||||
MACHINE_ARCH_host?= ${_HOST_ARCH}
|
MACHINE_ARCH_host?= ${_HOST_ARCH}
|
||||||
|
MACHINE_ARCH_host32?= ${_HOST_ARCH32}
|
||||||
|
|
||||||
MACHINE_ARCH_LIST_arm?= armv7 ${EXTRA_ARCHES_arm}
|
MACHINE_ARCH_LIST_arm?= armv7 ${EXTRA_ARCHES_arm}
|
||||||
MACHINE_ARCH_LIST_arm64?= aarch64
|
MACHINE_ARCH_LIST_arm64?= aarch64
|
||||||
|
|||||||
@@ -95,4 +95,11 @@ META_COOKIE_RM?=
|
|||||||
META_COOKIE_TOUCH?=
|
META_COOKIE_TOUCH?=
|
||||||
META_DEPS+= ${META_NOPHONY}
|
META_DEPS+= ${META_NOPHONY}
|
||||||
|
|
||||||
|
.if ${MACHINE:Nhost*:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
|
||||||
|
# cross-building
|
||||||
|
CROSS_TARGET_FLAGS?= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
|
||||||
|
CFLAGS+= ${CROSS_TARGET_FLAGS}
|
||||||
|
ACFLAGS+= ${CROSS_TARGET_FLAGS}
|
||||||
|
.endif
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# We want to build some host tools (eg makefs, mkimg) for Linux
|
# We want to build some host tools (eg makefs, mkimg) for Linux
|
||||||
# This only gets included during DIRDEPS_BUILD when MACHINE is "host"
|
# This only gets included during DIRDEPS_BUILD when MACHINE is "host"
|
||||||
|
# or "host32"
|
||||||
|
|
||||||
CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux
|
CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux
|
||||||
|
|
||||||
@@ -13,3 +14,5 @@ LIBADD+= egacy m
|
|||||||
# Bring in the full GNU namespace
|
# Bring in the full GNU namespace
|
||||||
CFLAGS+= -D_GNU_SOURCE
|
CFLAGS+= -D_GNU_SOURCE
|
||||||
|
|
||||||
|
# for sane staging behavior
|
||||||
|
LN= ln -L
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ BROKEN_OPTIONS+= OFED
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
# MK_host_egacy is set by local.sys.mk so is valid here
|
# MK_host_egacy is set by local.sys.mk so is valid here
|
||||||
.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
|
.if ${MACHINE:Nhost*} == "" && ${MK_host_egacy} == "yes"
|
||||||
# we cannot expect tests to work
|
# we cannot expect tests to work
|
||||||
BROKEN_OPTIONS+= TESTS
|
BROKEN_OPTIONS+= TESTS
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ CHACHA20INCS+= ${SRCTOP}/sys/crypto/chacha20/_chacha.h \
|
|||||||
|
|
||||||
.if ${MACHINE} == "host"
|
.if ${MACHINE} == "host"
|
||||||
_host_arch= ${_HOST_ARCH}
|
_host_arch= ${_HOST_ARCH}
|
||||||
|
.elif ${MACHINE} == "host32"
|
||||||
|
_host_arch= ${_HOST_ARCH32}
|
||||||
.else
|
.else
|
||||||
_host_arch=${MACHINE}
|
_host_arch=${MACHINE}
|
||||||
.endif
|
.endif
|
||||||
|
|||||||
Reference in New Issue
Block a user