Re: make: using wildcard in rule based on stem

[email protected] Thu, 23 Oct 2014 02:24:11 -0700 (PDT)
Newsgroups gmane.comp.gnu.utils
Message-ID <[email protected]>
Functions do accept % as argument, but strange things happen. Consider this makefile (run with files Barticle and article in the directory)

art = article
scan = $(wildcard *$(1)) $(1)

article.xsl metadata.xsl: %.xsl: $(call scan,$(art))
    @echo result $^

The result is 
'result Barticle article'

It shows the scan function works as expected. However, if the call to scan is replaced by $(call scan,%), (note % has the same value as $(art)) the result becomes
'result article'.

It shows the wildcard function does not do its job properly. This becomes even more clear when the definition of scan is replaced by 'scan = $(wildcard *$(1) $(1))'. The result becomes
'result'

Replacing the scan-call back to its original $(call scan,$(art)), the result becomes the (again) expected:
'result Barticle article'

This smells like a bug. Is there a workaround available, like copying the contents of the variable?

thanks, Ruud