Re: gmake and ccache conspiring together in creating gremlins

Dmitry Goncharov via Bug reports and discussion for GNU make <[email protected]> Mon, 8 Feb 2021 12:51:58 -0500
Newsgroups gmane.comp.gnu.make.bugs,gmane.comp.compilers.ccache
Message-ID <CAG+Z0CvpKaHaZTCFkC2MfxeVFqukO1vMFrS5T7TJQVhLB3XjjQ@mail.gmail.com>
On Mon, Feb 8, 2021 at 12:36 PM Edward Welbourne <[email protected]> wrote:
> Sounds to me like that's a bug: when the descriptors are closed, the
> part of MAKEFLAGS that claims they're make's jobserver file descriptors
> should be removed, since that's when the claim stops being true.

make uses posix_spawn by default to create children.
posix_spawn makes it difficult to modify env per child.
As a workaround the user can have the recipe remove (or modify) MAKEFLAGS
E.g.

%.o: %.c ; unset MAKEFLAGS && $(CC)  $(CFLAGS) -o $@ -c $<

regards, Dmitry