Page MenuHomeFreeBSD

D50313.id155614.diff
No OneTemporary

D50313.id155614.diff

diff --git a/share/mk/auto.obj.mk b/share/mk/auto.obj.mk
--- a/share/mk/auto.obj.mk
+++ b/share/mk/auto.obj.mk
@@ -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?= ${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 @@
.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}
diff --git a/share/mk/jobs.mk b/share/mk/jobs.mk
--- a/share/mk/jobs.mk
+++ b/share/mk/jobs.mk
@@ -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 @@
.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 @@
# 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
diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk
--- a/share/mk/src.sys.obj.mk
+++ b/share/mk/src.sys.obj.mk
@@ -73,6 +73,12 @@
.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"
diff --git a/share/mk/stage-install.sh b/share/mk/stage-install.sh
--- a/share/mk/stage-install.sh
+++ b/share/mk/stage-install.sh
@@ -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 @@
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 @@
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

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 23, 11:21 PM (12 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27891435
Default Alt Text
D50313.id155614.diff (5 KB)

Event Timeline