Problem with secondary expansion and target specific variables

2012-12-30 Thread Thomas Daniel

The following makefile.1 produces correct results:
---
target1 : var := one
target2 : var := two

targets := target1 target2

all : $(targets)

.SECONDEXPANSION:
$(targets) : foo/$$(var)/bar

foo/%/bar :
mkdir -p $(dir $@)
touch $@

.PHONY : target1 target2
-

> make -f makefile.1
mkdir -p foo/one/
touch foo/one/bar
mkdir -p foo/two/
touch foo/two/bar

However, makefile.2 does not pick up var:
-
target1 : var := one
target2 : var := two

targets := target1 target2

all : $(targets)

.SECONDEXPANSION:
$(targets) : test/$$@

$(targets:%=test/%) : foo/$$(var)/bar

foo/%/bar :
mkdir -p $(dir $@)
touch $@

.PHONY : $(targets) $(targets:%=test/%)


> make -f makefile.2
make: *** No rule to make target `foo//bar', needed by `test/target1'.  
Stop.


According to make documentation:
"when you define a target-specific variable that variable value is also 
in effect for all prerequisites of this target, and all their 
prerequisites, etc."


Since test/target1 is a prerequisite for target1 and var is defined for 
target1, it should be available also for test/target1. Secondary 
expansion works when expanding 'var' for target1 and target2 in 
makefile.1, but it doesn't when expanding it in makefile.2


Am I doing something incorrect here or is it an unimplemented 
functionality, specifically that target specific variables are not 
inherited in prerequisites  of prerequisite?


The behavior is the same in 3.81 and 3.82.

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


Dependency violation in parallel build (3.82, regression)

2012-12-30 Thread Frank Heckenbach
Using the attached Makefile, I get the following result:

% rm -f foo; make -j
foo1
bar1
qux
start foo
bar
foo

So the qux recipe is run before foo is finished (or even started),
although qux depends on foo. The $(shell) calls as well as
.SECONDARY and the seemingly unrelated bar rules all seem to be
necessary to trigger the bug.

This is reproducible with 3.82. It does not seem to occur with 3.81.

BTW, I wanted to check against the current repository version, but
when I tried to fetch it as described on
https://savannah.gnu.org/git/?group=make, I got:

% git clone git://git.savannah.gnu.org/make.git
Cloning into make...
warning: You appear to have cloned an empty repository.


Makefile
Description: Binary data
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: Dependency violation in parallel build (3.82, regression)

2012-12-30 Thread Eli Zaretskii
> Date: Sun, 30 Dec 2012 23:38:44 +0100
> From: Frank Heckenbach 
> 
> BTW, I wanted to check against the current repository version, but
> when I tried to fetch it as described on
> https://savannah.gnu.org/git/?group=make, I got:
> 
> % git clone git://git.savannah.gnu.org/make.git
> Cloning into make...
> warning: You appear to have cloned an empty repository.

Use CVS, not git, to fetch the latest development sources of Make.

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