[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gmake feature (enhancement)
From: |
Paul Smith |
Subject: |
Re: gmake feature (enhancement) |
Date: |
Wed, 24 Jan 2018 09:34:25 -0500 |
On Wed, 2018-01-24 at 12:46 +0100, Phi Debian wrote:
> 1) I'd like that -jN do leave some foot print in the environment, OR
> better set a gmake internal variable (predefined name) with the number
> that as given.
> 2) I'd like o suppress the enter/leaving message.
> make: Entering directory '...'
> make: Leaving directory '...'
The answer to both your questions is the MAKEFLAGS variable (although
for the first one you need GNU make 4.2 or higher).
https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html
The amount of -j is available in MAKEFLAGS; with no -j:
$ echo 'all:;$(info MAKEFLAGS is $(MAKEFLAGS))' | make -f-
MAKEFLAGS is
With some -j:
$ echo 'all:;$(info MAKEFLAGS is $(MAKEFLAGS))' | make -f- -j5
MAKEFLAGS is -j5 --jobserver-auth=3,4
(ignore the jobserver option). So you can use something like:
$ echo 'all:;$(info -j is $(patsubst -j%,%,$(filter
-j%,$(MAKEFLAGS))))' | make -f-
-j is
$ echo 'all:;$(info -j is $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))))' |
make -f- -j5
-j is 5
For suppressing enter/leave messages, you can just add --no-print-
directory to MAKEFLAGS yourself, for example in the makefile:
$ cat Makefile
all: ; $(MAKE) recurse
recurse: ; : recurse
$ make
make recurse
make[1]: Entering directory '/tmp'
: recurse
make[1]: Leaving directory '/tmp'
Now try:
$ cat Makefile
MAKEFLAGS += --no-print-directory
all: ; $(MAKE) recurse
recurse: ; : recurse
$ make
make recurse
: recurse