head	1.6;
access;
symbols
	netbsd-11-0-RC4:1.1
	netbsd-11-0-RC3:1.1
	netbsd-11-0-RC2:1.1
	netbsd-11-0-RC1:1.1
	perseant-exfatfs:1.1.0.4
	perseant-exfatfs-base-20250801:1.1
	netbsd-11:1.1.0.2
	netbsd-11-base:1.1;
locks; strict;
comment	@# @;


1.6
date	2026.03.09.20.09.10;	author sjg;	state Exp;
branches;
next	1.5;
commitid	Jr14hwVD8UBw4lxG;

1.5
date	2026.02.10.18.53.34;	author sjg;	state Exp;
branches;
next	1.4;
commitid	pvj2zluBGR7owRtG;

1.4
date	2026.02.01.16.42.35;	author rillig;	state Exp;
branches;
next	1.3;
commitid	QDTzAMUxdyOj5HsG;

1.3
date	2026.02.01.15.37.24;	author rillig;	state Exp;
branches;
next	1.2;
commitid	nNWydsKM9oPSIGsG;

1.2
date	2026.02.01.15.20.18;	author rillig;	state Exp;
branches;
next	1.1;
commitid	sHRxMpOq7aGlCGsG;

1.1
date	2025.06.13.03.51.18;	author rillig;	state Exp;
branches
	1.1.4.1;
next	;
commitid	Dmn2d9jxc5gaiGYF;

1.1.4.1
date	2025.06.13.03.51.18;	author perseant;	state dead;
branches;
next	1.1.4.2;
commitid	23j6GFaDws3O875G;

1.1.4.2
date	2025.08.02.05.58.40;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;


desc
@@


1.6
log
@make: ensure tests can be run in parallel

with a common link .make one test can hose another.

PR: 60016
@
text
@make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error" from varname-make_stack_trace.mk:42
	in make[2] in directory "<curdir>"
*** Error code 2 (continuing)

Stop.
make: stopped making "disabled-compat" in unit-tests
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error" from varname-make_stack_trace.mk:42
	in make[2] in directory "<curdir>"
*** [disabled-parallel] Error code 2

make: stopped making "disabled-parallel" in unit-tests
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error" from varname-make_stack_trace.mk:42
	in make[2] in directory "<curdir>"
	in command "make -f varname-make_stack_trace.mk provoke-error"
	in target "enabled-compat" from varname-make_stack_trace.mk:35
	in make[1] in directory "<curdir>"
*** Error code 2 (continuing)

Stop.
make: stopped making "enabled-compat" in unit-tests
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error" from varname-make_stack_trace.mk:42
	in make[2] in directory "<curdir>"
	in target "enabled-parallel" from varname-make_stack_trace.mk:39
	in make[1] in directory "<curdir>"
*** [enabled-parallel] Error code 2

make: stopped making "enabled-parallel" in unit-tests
.make[5]: warning: Invalid internal option "-J" in "<curdir>"; see the manual page
	in .make[5] in directory "<curdir>"
	in target "multi-stage-4" from varname-make_stack_trace.mk:56
	in make[4] in directory "<curdir>"
	in target "multi-stage-3" from varname-make_stack_trace.mk:54
	in make[3] in directory "<curdir>"
	in target "multi-stage-2" from varname-make_stack_trace.mk:52
	in make[2] in directory "<curdir>"
	in target "multi-stage-1" from varname-make_stack_trace.mk:50
	in make[1] in directory "<curdir>"
exit status 0
@


1.5
log
@make: move MaybeSubMake to job.c

Simplify MaybeSubMake to work on the expanded command from
JobWriteCommand, we check for progname sans any "[level]".

This improves reliability and reduces overhead as we only
scan commands that will actually be run - in jobs mode.

In meta_oodate we need to know of OP_SUBMAKE when deciding if
a .meta file is needed or not - and therefor needs checking.
This obviously happens before JobWriteCommand is called, so we may
have to check MaybeSubMake from meta_needed. If so, we set a flag
doneSubmake so JobWriteCommand will not recheck.

Tweak the few unit-tests that are impacted.
In particular; we have to use a symlink .make -> ${MAKE} to be able
to defeat MaybeSubMake and trigger warnings about bogus -J args.

Reviewed by: rillig
@
text
@d4 1
a4 1
	in target "provoke-error" from varname-make_stack_trace.mk:39
d13 1
a13 1
	in target "provoke-error" from varname-make_stack_trace.mk:39
d21 1
a21 1
	in target "provoke-error" from varname-make_stack_trace.mk:39
d24 1
a24 1
	in target "enabled-compat" from varname-make_stack_trace.mk:32
d33 1
a33 1
	in target "provoke-error" from varname-make_stack_trace.mk:39
d35 1
a35 1
	in target "enabled-parallel" from varname-make_stack_trace.mk:36
d42 1
a42 1
	in target "multi-stage-4" from varname-make_stack_trace.mk:53
d44 1
a44 1
	in target "multi-stage-3" from varname-make_stack_trace.mk:51
d46 1
a46 1
	in target "multi-stage-2" from varname-make_stack_trace.mk:49
d48 1
a48 1
	in target "multi-stage-1" from varname-make_stack_trace.mk:47
@


1.4
log
@make: in stack traces, add location information for targets
@
text
@d4 1
a4 1
	in target "provoke-error" from varname-make_stack_trace.mk:38
d13 1
a13 1
	in target "provoke-error" from varname-make_stack_trace.mk:38
d21 1
a21 1
	in target "provoke-error" from varname-make_stack_trace.mk:38
d24 1
a24 1
	in target "enabled-compat" from varname-make_stack_trace.mk:31
d33 1
a33 1
	in target "provoke-error" from varname-make_stack_trace.mk:38
d35 1
a35 1
	in target "enabled-parallel" from varname-make_stack_trace.mk:35
d40 3
a42 3
make: warning: Invalid internal option "-J" in "<curdir>"; see the manual page
	in make[5] in directory "<curdir>"
	in target "multi-stage-4" from varname-make_stack_trace.mk:52
d44 1
a44 1
	in target "multi-stage-3" from varname-make_stack_trace.mk:50
d46 1
a46 1
	in target "multi-stage-2" from varname-make_stack_trace.mk:48
d48 1
a48 1
	in target "multi-stage-1" from varname-make_stack_trace.mk:46
@


1.3
log
@make: print the stack trace exactly once on invalid -J option
@
text
@d4 1
a4 1
	in target "provoke-error"
d13 1
a13 1
	in target "provoke-error"
d21 1
a21 1
	in target "provoke-error"
d24 1
a24 1
	in target "enabled-compat"
d33 1
a33 1
	in target "provoke-error"
d35 1
a35 1
	in target "enabled-parallel"
d42 1
a42 1
	in target "multi-stage-4"
d44 1
a44 1
	in target "multi-stage-3"
d46 1
a46 1
	in target "multi-stage-2"
d48 1
a48 1
	in target "multi-stage-1"
@


1.2
log
@tests/make: demonstrate duplicate stack trace on invalid -J option

Spotted by Greg Troxel.

https://mail-index.netbsd.org/pkgsrc-users/2026/02/01/msg042558.html
@
text
@a49 9
	in make[5] in directory "<curdir>"
	in target "multi-stage-4"
	in make[4] in directory "<curdir>"
	in target "multi-stage-3"
	in make[3] in directory "<curdir>"
	in target "multi-stage-2"
	in make[2] in directory "<curdir>"
	in target "multi-stage-1"
	in make[1] in directory "<curdir>"
@


1.1
log
@make: add on-demand inter-process stack traces

When debugging a build that heavily uses nested calls to sub-makes, the
chain of calls is useful to quickly assess the situation.  If explicitly
requested, include the actions from any parent processes in the stack
traces.

Reviewed by: sjg
@
text
@d40 19
@


1.1.4.1
log
@file varname-make_stack_trace.exp was added on branch perseant-exfatfs on 2025-08-02 05:58:40 +0000
@
text
@d1 40
@


1.1.4.2
log
@Sync with HEAD
@
text
@a0 40
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error"
	in make[2] in directory "<curdir>"
*** Error code 2 (continuing)

Stop.
make: stopped making "disabled-compat" in unit-tests
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error"
	in make[2] in directory "<curdir>"
*** [disabled-parallel] Error code 2

make: stopped making "disabled-parallel" in unit-tests
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error"
	in make[2] in directory "<curdir>"
	in command "make -f varname-make_stack_trace.mk provoke-error"
	in target "enabled-compat"
	in make[1] in directory "<curdir>"
*** Error code 2 (continuing)

Stop.
make: stopped making "enabled-compat" in unit-tests
make: Unknown modifier ":Z"
	while evaluating "${:Z}" with value ""
	in command "@@echo ${:Z}"
	in target "provoke-error"
	in make[2] in directory "<curdir>"
	in target "enabled-parallel"
	in make[1] in directory "<curdir>"
*** [enabled-parallel] Error code 2

make: stopped making "enabled-parallel" in unit-tests
exit status 0
@


