summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-02-21 20:32:12 -0500
committerPaul Smith <psmith@gnu.org>2023-02-21 20:53:48 -0500
commit8b8cc3a825b0e9e176db5d90084c814e3744a300 (patch)
tree2f36ba8fe6274849c6fb9b38882bf4f5b5a39a00 /src
parent9b6fedef1ce34391e60cc96d1cb52b9884a8339a (diff)
downloadmake-git-8b8cc3a825b0e9e176db5d90084c814e3744a300.tar.gz
Use a recursive environment if any command needs it
We only create one target environment for all commands in a recipe. Ensure it's set for recursive make if ANY command is recursive, not just the first one. * src/job.c (start_job_command): Check for any recursive command. * tests/scripts/features/jobserver: Test recursion on second line.
Diffstat (limited to 'src')
-rw-r--r--src/job.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/job.c b/src/job.c
index 94df0197..ea885614 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1420,9 +1420,16 @@ start_job_command (struct child *child)
child->deleted = 0;
#ifndef _AMIGA
- /* Set up the environment for the child. */
+ /* Set up the environment for the child.
+ It's a slight inaccuracy to set the environment for recursive make even
+ for command lines that aren't recursive, but I don't want to have to
+ recompute the target environment for each command. Better would be to
+ keep a separate entry for MAKEFLAGS in the environment so it could be
+ replaced on its own. For now just set it for all lines.
+ */
if (child->environment == 0)
- child->environment = target_environment (child->file, child->recursive);
+ child->environment = target_environment (child->file,
+ child->file->cmds->any_recurse);
#endif
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)