bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Behavior change related to MAKEFLAGS and recursive make in version 4


From: Martin Dorey
Subject: Re: Behavior change related to MAKEFLAGS and recursive make in version 4.4.1
Date: Thu, 25 Jan 2024 20:06:30 +0000

I can reproduce the behavior with today's git code (modulo the one unpushed change of Dmitry's that has my +1, https://savannah.gnu.org/bugs/index.php?64259).  Rereading https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html, I think you've got a case.  My two cents is hardly worth bothering the list with, but, reading:

  • unlike other environment variables, MAKEFLAGS specified in the environment take precedence over MAKEFLAGS specified in the makefile 

I was moved to try adding "override " to the first line of Makefile.  Then the behavior is the same with latest make and the 4.2.1 that I happen to have in /usr/bin.


From: bug-make-bounces+martin.dorey=hds.com@gnu.org <bug-make-bounces+martin.dorey=hds.com@gnu.org> on behalf of Ouellette, Paul <p-ouellette@ti.com>
Sent: Thursday, January 25, 2024 07:28
To: bug-make@gnu.org <bug-make@gnu.org>
Subject: Behavior change related to MAKEFLAGS and recursive make in version 4.4.1
 
***** EXTERNAL EMAIL *****

Hello,

Consider the following makefiles:
$ cat Makefile
MAKEFLAGS+=VAR=foo
all:
        $(info make VAR=$(VAR))
        @echo "env  VAR=$$VAR"
        $(MAKE) -C lib
$ cat lib/Makefile
all:
        @echo "env  VAR=$$VAR"
        $(info make VAR=$(VAR))

With GNU Make 4.4 and older, the output is:
$ make --no-print-directory
make VAR=foo
env  VAR=foo
make -C lib
make VAR=foo
env  VAR=foo

With GNU Make 4.4.1, the output is:
$ make --no-print-directory
make VAR=foo
env  VAR=
make -C lib
make VAR=
env  VAR=

I have a makefile that depends on VAR being set in the sub-make as in Make 4.4.
Was I depending on a bug or undefined behavior or is this a bug in Make 4.4.1?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]