Support the MAKE_TMPDIR environment variable

Allow build systems to choose an alternative location for make to
store its temporary files.

* NEWS: Announce the new environment variable.
* doc/make.texi (Temporary Files): Provide documentation.
* src/misc.c (get_tmpdir): Split into a new function.  Compute the
temporary directory and store it in a static location.
* tests/scripts/features/jobserver: Add a test of MAKE_TMPDIR.
This commit is contained in:
Paul Smith
2022-09-11 10:56:08 -04:00
parent 02b3a6ad46
commit 86fc644dcc
4 changed files with 75 additions and 15 deletions

View File

@@ -145,6 +145,16 @@ if (exists $FEATURES{'jobserver-fifo'}) {
$ENV{TMPDIR} = "nosuchdir";
run_make_test(undef, '-j2', "/Nothing to be done/");
# Verify that MAKE_TMPDIR is preferred if provided
$ENV{MAKE_TMPDIR} = '.';
$ENV{TMPDIR} = 'nosuchdir';
run_make_test(q!
recurse: ; @$(MAKE) -f #MAKEFILE# all
all:;@echo "$$MAKEFLAGS"
!,
"-j2 --no-print-directory", "/--jobserver-auth=fifo:\\./");
}
1;