Hi,

I have a large system based on GNU Make. In order to get parallel builds
working properly, I need to check to see if make was invoked with the -j
flag. I thought I would check the value of MAKEFLAGS. It turns out that
is not so simple. As far as I can tell, the -j flags is treated in a
special way that stops me from doing this. Here is an example:

--------------------------------------------------------
|abacus>cat GNUmakefile
makeflags_here:=$(MAKEFLAGS)
printem:
        @echo MAKEFLAGS=$(MAKEFLAGS)
        @echo makeflags there=$(makeflags_here)

|abacus>make -k
MAKEFLAGS=k
makeflags there=k

|abacus>make -j
MAKEFLAGS=j
makeflags there=

|abacus>make -j 2 
MAKEFLAGS= --jobserver-fds=4,5 -j
makeflags there=

|abacus>make --version
GNU Make version 3.78.1, by Richard Stallman and Roland McGrath.
Built for i386-redhat-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <[EMAIL PROTECTED]>.

---------------------------------------------------------

I chose -k as an example of a flag other than -j. Many such flags behave
the same way as -k. If I had needed to test for the -k flag, I could do
so. However, there does not appear to be any way to test for the -j flag
until command execution time -- when it is too late. Is there any hope
for me?

Thanks,
Jim Amundson

Reply via email to