[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible bug in Make's target-specific variable behavior
From: |
Nicholas Clark |
Subject: |
Possible bug in Make's target-specific variable behavior |
Date: |
Sat, 1 May 2021 13:53:58 -0600 |
Hi all,
I was experimenting with Make today, and I noticed a possible bug in Make's
target-specific variable handling.
>From the GNU Make manual (
https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html#Target_002dspecific),
I'd expect that I could combine "export" and "private" on the same
target-specific variable, in order to get environment variables local to a
single recipe.
But when I try it out, I see the variable in the target's dependencies as
well - exactly the behavior that "private" is supposed to block.
Here's an example Makefile that shows the problem.
#----------------------------------------#
default: noexport export
.RECIPEPREFIX = >
noexport_dep:
> @echo "$@: TEST_VALUE=[$(TEST_VALUE)]"
noexport: private TEST_VALUE=HELLO
noexport: noexport_dep
> @echo "$@: TEST_VALUE=[$(TEST_VALUE)]"
##
export_dep:
> @echo "$@: TEST_VALUE=[$$TEST_VALUE]"
export: private export TEST_VALUE=HELLO
export: export_dep
> @echo "$@: TEST_VALUE=[$$TEST_VALUE]"
#----------------------------------------#
>From the GNU Make manual, I'd expect to see this output:
user@hostname$ make
noexport_dep: TEST_VALUE=[]
noexport: TEST_VALUE=[HELLO]
export_dep: TEST_VALUE=[]
export: TEST_VALUE=[HELLO]
Instead, I see this output:
user@hostname$ make
noexport_dep: TEST_VALUE=[]
noexport: TEST_VALUE=[HELLO]
export_dep: TEST_VALUE=[HELLO]
export: TEST_VALUE=[HELLO]
Any thoughts on this? Is this a bug, or did I misinterpret the Make manual?
-Nick
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Possible bug in Make's target-specific variable behavior,
Nicholas Clark <=