> 1. "foo" is simple variable.
>    so result have to be 100 but is 200
> 
> foo :=
> val := 100
> 
> all : foo += $(val)
> all :
>       @echo foo : $(foo)
> 
> val := 200
> 
> result is : 200

Yes, the result will become 200 because foo is not expanded until it is
usead at the line "@echo foo : $(foo)". At that time, before building
"all" the entire Makefile will have been read and val was assigned to 200
at the last line in the Makefile.

> -------------------------------------------------------
> 
> 2. If i change '+=' operator to ':=' then result is 100
> 
> foo :=
> val := 100
> 
> all : foo := $(val)
> all :
>       @echo foo : $(foo)
> 
> val := 200
> 
> result is : 100
> ----------------------------------

Yes, because ":=" unlike "=" and "+=" is expanded at that very line. 

regards Henrik

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to