conditional target specific variables

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

conditional target specific variables

Emmanuel Mayssat
Sample makefile
$ cat Makefile
SETIN01?=0
SETIN012?=0

1: SETIN1?=1
1: SETIN12?=1
1: SETIN01?=1
1: SETIN012?=1
1: 2
    @echo "---------- 1 -------------"
    @echo " SETIN1     is $(SETIN1)"
    @echo " SETIN2     is $(SETIN2)"
    @echo " SETIN12    is $(SETIN12)"
    @echo " SETIN01    is $(SETIN01)"
    @echo " SETIN012   is $(SETIN012)"

2: SETIN2?=2
2: SETIN12?=2
2: SETIN012?=2
2:
    @echo "---------- 2 -------------"
    @echo " SETIN1     is $(SETIN1)"
    @echo " SETIN2     is $(SETIN2)"
    @echo " SETIN12    is $(SETIN12)"
    @echo " SETIN01    is $(SETIN01)"
    @echo " SETIN012   is $(SETIN012)"


# Now when I run
$ make 2
---------- 2 -------------
 SETIN1     is
 SETIN2     is 2
 SETIN12    is 2
 SETIN01    is 0
 SETIN012   is 0

The results above are as expected. But when I run

$ make 1
---------- 2 -------------
 SETIN1     is 1
 SETIN2     is 2
 SETIN12    is 2
 SETIN01    is 0
 SETIN012   is 0
---------- 1 -------------
 SETIN1     is 1
 SETIN2     is
 SETIN12    is 1
 SETIN01    is 0
 SETIN012   is 0

why is in 2 SETIN12 equals to 2 instead of 1?
why is in 1 SETIN12 value different than in 2?

Because SETIN1, we can see that the variables of 1 are read (including
SETIN12), but still 2 considers that SETIN12 is not set and reset it to 2.

Why don't the variable in the 'called target' have priority on the variable
defined in its dependencies?

--
Emmanuel
Menlo Security, Inc.
Menlo Park, CA


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: conditional target specific variables

Paul Smith-20
On Mon, 2016-10-10 at 14:39 -0700, Emmanuel Mayssat wrote:
> why is in 2 SETIN12 equals to 2 instead of 1?
> why is in 1 SETIN12 value different than in 2?

This is a long-standing issue.

See: https://savannah.gnu.org/bugs/?18305

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make