Re: Compacting link-rules

2018-10-19 Thread Paul Smith
On Fri, 2018-10-19 at 09:26 +0300, Eddy Petrișor wrote:
> I have a similar issue, but in my case I used explicit pattern rules,
> vpath and added compiler generated .d files to make sure the object
> files are regenerated on .h modification, but the end result was that
> the pattern rules were no longer called after the initial generation.
> 
> My tentative explanation is that the .d dependency rules are
> considered more specific (but empty) than the pattern rules and/or
> vpath is at fault, also.
> 
> Is this explanation correct? Will the issue also appear in the
> solution above?

I'm sorry but I don't understand your description.  If you would like
some help please post a minimal, complete example (and create a new
mailing list thread for it).  Cheers!


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


Re: Compacting link-rules

2018-10-19 Thread Paul Smith
On Fri, 2018-10-19 at 09:39 +, Edward Welbourne wrote:
> TARGETS = bin/animation.exe bin/barchart.exe ...
> 
> $(TARGETS): bin/%.exe: $(%_OBJ) $(LIBS)
>   $(call link_EXE, $@, $^)

If you try this, you'll see it doesn't work.

Variables are expanded before the pattern is substituted, so $(%_OBJ)
tries to expand the variable %_OBJ which is empty.


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


Re: Compacting link-rules

2018-10-19 Thread Edward Welbourne
Paul Smith wrote:

>>> All the .obj files are missing!?
>>
>> Oh.  $@ is "bin/animation.exe" so $(@F) is "animation.exe" and
>> $($(@F)_OBJ) would be "animation.exe_OBJ" but that's not the name of
>> your variable, so it expands to the empty string.
>>
>> Sorry I didn't catch this problem in your original suggestion.
>>
>> You want:
>>
>>bin/%.exe: $$($$*_OBJ) $(LIBS)
>>...
>>
>> because $* matches the pattern stem, which is "animation" in this case.

Gisle Vanem (18 October 2018 19:40) replied:
> That seems to work fine. Thanks a lot!

Good to hear.  For completeness's sake,
note another approach that might work:

TARGETS = bin/animation.exe bin/barchart.exe ...

$(TARGETS): bin/%.exe: $(%_OBJ) $(LIBS)
  $(call link_EXE, $@, $^)

using the other kind of pattern rule,

Eddy.

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