Export SB_OBJROOT for later reference
The build varies MAKEOBJDIRPREFIX at times which can make it difficult to track the original OBJROOT. This is easier when we get the original from env as SB_OBJROOT. If SB_OBJROOT did not come from env, set and export it the first time we set OBJROOT. This allows SB_OBJROOT to be used in .MAKE.META.IGNORE* variables to tweak what should be considered as making a target out-of-date. Update auto.obj.mk to latest from contrib/bmake - handles relative objdirs more simply and reliably. Also update jobs.mk and stage-install.sh Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D50313
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# $Id: auto.obj.mk,v 1.17 2024/02/17 17:26:57 sjg Exp $
|
||||
# $Id: auto.obj.mk,v 1.20 2025/05/17 15:29:55 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2004, Simon J. Gerraty
|
||||
# @(#) Copyright (c) 2004-2025, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
@@ -50,7 +50,12 @@ __objdir?= ${.CURDIR}
|
||||
__objdir?= ${MAKEOBJDIRPREFIX}${.CURDIR}
|
||||
.endif
|
||||
__objdir?= ${MAKEOBJDIR:Uobj}
|
||||
__objdir:= ${__objdir}
|
||||
# relative dirs can cause trouble below
|
||||
# keep it simple and convert to absolute path now if needed
|
||||
.if ${__objdir:M/*} == ""
|
||||
# avoid ugly ${.CURDIR}/./obj etc.
|
||||
__objdir:= ${.CURDIR}/${__objdir:S,^./,,}
|
||||
.endif
|
||||
.if ${.OBJDIR:tA} != ${__objdir:tA}
|
||||
# We need to chdir, make the directory if needed
|
||||
.if !exists(${__objdir}/) && \
|
||||
@@ -65,11 +70,9 @@ __objdir_made != echo ${__objdir}/; umask ${OBJDIR_UMASK:U002}; \
|
||||
.if ${.OBJDIR:tA} != ${__objdir:tA}
|
||||
# we did not get what we want - do we care?
|
||||
.if ${__objdir_made:Uno:M${__objdir}/*} != ""
|
||||
# watch out for __objdir being relative path
|
||||
.if !(${__objdir:M/*} == "" && ${.OBJDIR:tA} == ${${.CURDIR}/${__objdir}:L:tA})
|
||||
# we attempted to make ${__objdir} and failed
|
||||
.error could not use ${__objdir}: .OBJDIR=${.OBJDIR}
|
||||
.endif
|
||||
.endif
|
||||
# apparently we can live with it
|
||||
# make sure we know what we have
|
||||
.OBJDIR: ${.CURDIR}
|
||||
|
||||
+7
-4
@@ -1,6 +1,8 @@
|
||||
# $Id: jobs.mk,v 1.14 2023/09/11 16:52:44 sjg Exp $
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# @(#) Copyright (c) 2012-2023, Simon J. Gerraty
|
||||
# $Id: jobs.mk,v 1.19 2025/02/03 21:18:44 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2012-2025, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
@@ -66,7 +68,7 @@ NEWLOG_SH := ${(type newlog.sh) 2> /dev/null:L:sh:M/*}
|
||||
.endif
|
||||
.endif
|
||||
.if !empty(NEWLOG_SH) && exists(${NEWLOG_SH})
|
||||
NEWLOG := sh ${NEWLOG_SH}
|
||||
NEWLOG := ${.SHELL:Ush} ${NEWLOG_SH}
|
||||
JOB_NEWLOG_ARGS ?= -S -n ${JOB_LOG_GENS}
|
||||
.else
|
||||
NEWLOG = :
|
||||
@@ -78,7 +80,8 @@ JOB_MAX = ${.MAKE.JOBS}
|
||||
# This should be derrived from number of cpu's
|
||||
.if ${.MAKE.JOBS.C:Uno} == "yes"
|
||||
# 1.2 - 1.5 times nCPU works well on most machines that support -jC
|
||||
JOB_MAX_C ?= 1.33C
|
||||
# if the factor is floating point, the C suffix isn't needed
|
||||
JOB_MAX_C ?= 1.33
|
||||
JOB_MAX ?= ${JOB_MAX_C}
|
||||
.endif
|
||||
JOB_MAX ?= 8
|
||||
|
||||
@@ -73,6 +73,12 @@ OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
|
||||
.endif
|
||||
# Must export since OBJDIR will dynamically be based on it
|
||||
.export OBJROOT SRCTOP
|
||||
# if we didn't get SB_OBJROOT from env,
|
||||
# it is handy to set it now, so we can remember it
|
||||
.if empty(SB_OBJROOT)
|
||||
SB_OBJROOT:= ${OBJROOT}
|
||||
.export SB_OBJROOT
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MK_DIRDEPS_BUILD} == "no"
|
||||
|
||||
+57
-14
@@ -28,22 +28,28 @@
|
||||
# "file".dirdep placed in "dest" or "dest".dirdep if it happed
|
||||
# to be a file rather than a directory.
|
||||
#
|
||||
# Before we run install(1), we check if "dest" needs to be a
|
||||
# directory (more than one file in "args") and create it
|
||||
# if necessary.
|
||||
#
|
||||
# SEE ALSO:
|
||||
# meta.stage.mk
|
||||
#
|
||||
#
|
||||
|
||||
# RCSid:
|
||||
# $Id: stage-install.sh,v 1.5 2013/04/19 16:32:24 sjg Exp $
|
||||
# $Id: stage-install.sh,v 1.11 2024/02/17 17:26:57 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2013, Simon J. Gerraty
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# @(#) Copyright (c) 2013-2020, Simon J. Gerraty
|
||||
#
|
||||
# This file is provided in the hope that it will
|
||||
# be of use. There is absolutely NO WARRANTY.
|
||||
# Permission to copy, redistribute or otherwise
|
||||
# use this file is hereby granted provided that
|
||||
# use this file is hereby granted provided that
|
||||
# the above copyright notice and this notice are
|
||||
# left intact.
|
||||
#
|
||||
# left intact.
|
||||
#
|
||||
# Please send copies of changes and bug-fixes to:
|
||||
# sjg@crufty.net
|
||||
#
|
||||
@@ -59,6 +65,45 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
# get last entry from "$@" without side effects
|
||||
last_entry() {
|
||||
while [ $# -gt 8 ]
|
||||
do
|
||||
shift 8
|
||||
done
|
||||
eval last=\$$#
|
||||
echo $last
|
||||
}
|
||||
|
||||
# mkdir $dest if needed (more than one file)
|
||||
mkdir_if_needed() {
|
||||
(
|
||||
lf=
|
||||
while [ $# -gt 8 ]
|
||||
do
|
||||
shift 4
|
||||
done
|
||||
for f in "$@"
|
||||
do
|
||||
[ -f $f ] || continue
|
||||
[ $f = $dest ] && continue
|
||||
if [ -n "$lf" ]; then
|
||||
# dest must be a directory
|
||||
mkdir -p $dest
|
||||
break
|
||||
fi
|
||||
lf=$f
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
args="$@"
|
||||
dest=`last_entry "$@"`
|
||||
case " $args " in
|
||||
*" -d "*) ;;
|
||||
*) [ -e $dest ] || mkdir_if_needed "$@";;
|
||||
esac
|
||||
|
||||
# if .dirdep doesn't exist, just run install and be done
|
||||
_DIRDEP=${_DIRDEP:-$OBJDIR/.dirdep}
|
||||
[ -s $_DIRDEP ] && EXEC= || EXEC=exec
|
||||
@@ -74,18 +119,16 @@ StageDirdep() {
|
||||
t=$1
|
||||
if [ -s $t.dirdep ]; then
|
||||
cmp -s $_DIRDEP $t.dirdep && return
|
||||
echo "ERROR: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2
|
||||
exit 1
|
||||
case "${STAGE_CONFLICT:-error}" in
|
||||
[Ee]*) STAGE_CONFLICT=ERROR action=exit;;
|
||||
*) STAGE_CONFLICT=WARNING action=: ;;
|
||||
esac
|
||||
echo "$STAGE_CONFLICT: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2
|
||||
$action 1
|
||||
fi
|
||||
LnCp $_DIRDEP $t.dirdep || exit 1
|
||||
}
|
||||
|
||||
args="$@"
|
||||
while [ $# -gt 8 ]
|
||||
do
|
||||
shift 8
|
||||
done
|
||||
eval dest=\$$#
|
||||
if [ -f $dest ]; then
|
||||
# a file, there can be only one .dirdep needed
|
||||
StageDirdep $dest
|
||||
|
||||
Reference in New Issue
Block a user