[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: |
Dmitry Goncharov |
Subject: |
Re: Behavior change related to MAKEFLAGS and recursive make in version 4.4.1 |
Date: |
Thu, 25 Jan 2024 20:19:36 -0500 |
On Thu, Jan 25, 2024 at 12:39 PM Ouellette, Paul <p-ouellette@ti.com> wrote:
>
> 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))
>
Thank you for your report.
Variable VAR exists in the make database even with the latest make.
However, unlike older make, VAR is not exported.
i added variable "world" to your makefile for comparison.
$ ls
lib makefile
$ cat makefile
MAKEFLAGS+=VAR=foo
world=one
#export VAR world
all:
$(info parent make VAR=$(VAR), world=$(world))
@echo "parent env VAR=$$VAR, world=$$world"
$(MAKE) -C lib
$ cat lib/makefile
all:
$(info child make VAR=$(VAR), world=$(world))
@echo "child env VAR=$$VAR, world=$$world"
$ ~/src/gmake/make//m64//make --no-print-directory -rp |grep 'VAR = '
VAR = foo
$ ~/src/gmake/make//m64//make --no-print-directory -r
parent make VAR=foo, world=one
parent env VAR=, world=
/home/dgoncharov/src/gmake/make//m64//make -C lib
child make VAR=, world=
child env VAR=, world=
If we uncomment the export directive
$ cat makefile
MAKEFLAGS+=VAR=foo
world=one
export VAR world
all:
$(info parent make VAR=$(VAR), world=$(world))
@echo "parent env VAR=$$VAR, world=$$world"
$(MAKE) -C lib
$ ~/src/gmake/make//m64//make --no-print-directory -r
parent make VAR=foo, world=one
parent env VAR=foo, world=one
/home/dgoncharov/src/gmake/make//m64//make -C lib
child make VAR=foo, world=one
child env VAR=foo, world=one
$
We can see, VAR and world behave the same here.
We can also see that the older make would export VAR.
MAKEFLAGS is exported by default.
We can see, in older make variables defined in MAKEFLAGS were also
exported by default.
In the latest make variables defined in MAKEFLAGS are not exported by default.
Looks like we should restore exporting variables defined in MAKEFLAGS.
regards, Dmitry