Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109405516
D41946.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D41946.diff
View Options
diff --git a/share/mk/host-target.mk b/share/mk/host-target.mk
--- a/share/mk/host-target.mk
+++ b/share/mk/host-target.mk
@@ -1,32 +1,40 @@
# 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
+.if !target(__${.PARSEFILE}__)
+__${.PARSEFILE}__: .NOTMAIN
+
.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
.endif
.if !defined(_HOST_OSREL)
_HOST_OSREL != uname -r
.export _HOST_OSREL
.endif
-.if !defined(_HOST_MACHINE)
-_HOST_MACHINE != uname -m
-.export _HOST_MACHINE
-.endif
.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
# uname -p may produce garbage on linux
.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
-_HOST_ARCH := ${_HOST_MACHINE}
-.endif
+_HOST_ARCH = ${_HOST_MACHINE}
+.elif ${_HOST_OSNAME:NDarwin} == "" && ${_HOST_ARCH:Narm:Ni386} == ""
+# _HOST_MACHINE is more explicit/useful
+_HOST_ARCH = ${_HOST_MACHINE}
.endif
.export _HOST_ARCH
.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)
HOST_MACHINE := ${_HOST_MACHINE}
.export HOST_MACHINE
@@ -37,8 +45,20 @@
HOST_OS := ${_HOST_OSNAME}
host_os := ${_HOST_OSNAME:tl}
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 ?= tr
toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+.endif
diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk
--- a/share/mk/local.dirdeps.mk
+++ b/share/mk/local.dirdeps.mk
@@ -22,7 +22,9 @@
Ninclude* \
Nlib/csu* \
Nlib/libc \
+ Nlib/libcompiler_rt \
Nlib/[mn]* \
+ Nlib/lib[t]* \
Ngnu/lib/lib[a-r]* \
Nsecure/lib* \
Nusr.bin/xinstall* \
@@ -50,6 +52,8 @@
DIRDEPS_FILTER.host+= ${N_host_libs}
.endif
+DIRDEPS_FILTER.host32 = ${DIRDEPS_FILTER.host}
+
DIRDEPS_FILTER+= \
Nbin/cat.host \
${DIRDEPS_FILTER.xtras:U}
@@ -107,6 +111,7 @@
cddl/usr.bin/ctfmerge.host
.endif
+.if ${DEP_MACHINE:Nhost*} != ""
# 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
# -static or not is not known here.
@@ -115,6 +120,7 @@
lib/libgcc_eh \
lib/libgcc_s
.endif
+.endif
# 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.
diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk
--- a/share/mk/local.init.mk
+++ b/share/mk/local.init.mk
@@ -13,7 +13,7 @@
# XXX: This should be combined with external compiler support in Makefile.inc1
# 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}
CXXFLAGS_LAST+= --sysroot=${SYSROOT}
LDADD+= --sysroot=${SYSROOT}
@@ -29,8 +29,8 @@
LDADD+= -L${STAGE_LIBDIR}
.endif
-.if ${MACHINE} == "host"
-.if ${.MAKE.DEPENDFILE:E} != "host"
+.if ${MACHINE:Nhost*} == ""
+.if ${.MAKE.DEPENDFILE:E:Nhost*} != ""
UPDATE_DEPENDFILE?= no
.endif
HOST_CFLAGS+= -DHOSTPROG
diff --git a/share/mk/local.sys.dirdeps.env.mk b/share/mk/local.sys.dirdeps.env.mk
--- a/share/mk/local.sys.dirdeps.env.mk
+++ b/share/mk/local.sys.dirdeps.env.mk
@@ -24,17 +24,28 @@
.endfor
HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
+HOST_OBJTOP32 ?= ${OBJROOT}${HOST_TARGET32}
+.if ${.MAKE.LEVEL} == 0
.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
MACHINE= host
.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
# not what we want
TARGET_MACHINE= host
.endif
+.elif ${REQUESTED_MACHINE:U${MACHINE}} == "host32"
+MACHINE= host32
.endif
-.if ${MACHINE} == "host"
-OBJTOP := ${HOST_OBJTOP}
+.endif
+
+.if ${MACHINE:Nhost*} == ""
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
diff --git a/share/mk/local.sys.dirdeps.mk b/share/mk/local.sys.dirdeps.mk
--- a/share/mk/local.sys.dirdeps.mk
+++ b/share/mk/local.sys.dirdeps.mk
@@ -43,7 +43,7 @@
.-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.
UPDATE_DEPENDFILE?= NO
.endif
@@ -115,16 +115,10 @@
.endfor
.endif
-.if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
-# cross-building
.if !defined(FREEBSD_REVISION)
FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
.export FREEBSD_REVISION
.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
# so we can ensure any DEP_* values that might be used in
@@ -150,7 +144,7 @@
.endfor
.endif
-.if ${MACHINE} == "host" && ${.MAKE.OS} != "FreeBSD"
+.if ${MACHINE:Nhost*} == "" && ${.MAKE.OS} != "FreeBSD"
# some makefiles expect this
BOOTSTRAPPING= 0
.endif
diff --git a/share/mk/local.sys.machine.mk b/share/mk/local.sys.machine.mk
--- a/share/mk/local.sys.machine.mk
+++ b/share/mk/local.sys.machine.mk
@@ -1,10 +1,11 @@
.-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
MACHINE_ARCH_host?= ${_HOST_ARCH}
+MACHINE_ARCH_host32?= ${_HOST_ARCH32}
MACHINE_ARCH_LIST_arm?= armv7 ${EXTRA_ARCHES_arm}
MACHINE_ARCH_LIST_arm64?= aarch64
diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk
--- a/share/mk/local.sys.mk
+++ b/share/mk/local.sys.mk
@@ -95,4 +95,11 @@
META_COOKIE_TOUCH?=
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
diff --git a/share/mk/src.init.linux.mk b/share/mk/src.init.linux.mk
--- a/share/mk/src.init.linux.mk
+++ b/share/mk/src.init.linux.mk
@@ -1,5 +1,6 @@
# We want to build some host tools (eg makefs, mkimg) for Linux
# This only gets included during DIRDEPS_BUILD when MACHINE is "host"
+# or "host32"
CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux
@@ -13,3 +14,5 @@
# Bring in the full GNU namespace
CFLAGS+= -D_GNU_SOURCE
+# for sane staging behavior
+LN= ln -L
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -368,7 +368,7 @@
.endif
# 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
BROKEN_OPTIONS+= TESTS
.endif
diff --git a/tools/build/Makefile b/tools/build/Makefile
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -126,6 +126,8 @@
.if ${MACHINE} == "host"
_host_arch= ${_HOST_ARCH}
+.elif ${MACHINE} == "host32"
+_host_arch= ${_HOST_ARCH32}
.else
_host_arch=${MACHINE}
.endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 5, 3:54 PM (21 h, 11 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16476689
Default Alt Text
D41946.diff (8 KB)
Attached To
Mode
D41946: Add support for host32 for DIRDEPS_BUILD
Attached
Detach File
Event Timeline
Log In to Comment