[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
determining whether -jN was used
From: |
DSB |
Subject: |
determining whether -jN was used |
Date: |
Thu, 23 May 2024 11:34:45 -0400 |
The GNU make manual for 4.2.1 says this:
"To access the pipe you must parse the 'MAKEFLAGS' variable and look for
the argument string '--jobserver-auth=R,W'"
I don't actually need to work with the job server, just to know whether a
-j flag was passed, but from my reading it should be discoverable from
$(MAKEFLAGS). However, the test case below shows no indication in MAKEFLAGS
from a 4.2.1 version:
$ make-4.2.1 -j12 --no-print
Makefile:1: MAKEFLAGS=" --no-print-directory"
test1.mk:1: MAKEFLAGS=" --no-print-directory"
test2.mk:1: MAKEFLAGS=" --no-print-directory"
It's fine in 4.4.1 but that's too new:
$ make-4.4.1 -j12 --no-print
Makefile:1: MAKEFLAGS=" -j12 --no-print-directory"
test1.mk:1: MAKEFLAGS=" -j12 --jobserver-auth=fifo:/tmp/GMfifo30518
--no-print-directory"
test2.mk:1: MAKEFLAGS=" -j12 --jobserver-auth=fifo:/tmp/GMfifo30518
--no-print-directory"
I'm looking for a way, ideally usable as far back as 3.82,
of determining whether -j and thus the jobserver is in use. Is there a way?
Thx,
David
Test-case makefiles:
$ head -n10 Makefile test?.mk
==> Makefile <==
$(warning MAKEFLAGS="$(MAKEFLAGS)")
all: test1 test2
test1 test2:;@$(MAKE) -f $@.mk
==> test1.mk <==
$(warning MAKEFLAGS="$(MAKEFLAGS)")
all:;@:
==> test2.mk <==
$(warning MAKEFLAGS="$(MAKEFLAGS)")
all:;@:
- determining whether -jN was used,
DSB <=