1

I'd like to have a rule depending on a subset of rules based on a wildcard.

For instance, in Makefile: How to apply an equivalent to filter on multiple wildcards a convenient macro contains is defined.

Now imagine $(TEST_LIST) contains a list of tests.

With "contains", I can for instance write: test-foobar: $(call containing,foobar,$(TEST_LIST)

Then if TEST_LIST=foobar2 foobar3 bar2 foo5, test-foobar will depend on foobar2 foobar3

What I want to achieve is something like:

test-%: $(call containing,%,$(TEST_LIST))

So that I can type make test-foo, test-bar, test-foobar.

Unfortunately the above returns:

make: *** No rule to make target `test-foobar'.  Stop

So I digged and discovered second expansion. So now, my rule look like:

test-%: $$(call containing,$$*,$(TEST_LIST))

But that doesn't work! I need to at least have a command, e.g.:

test-%: $$(call containing,$$*,$(TEST_LIST))
    @echo Done

Do you know why I need this command @echo ?

Community
  • 1
  • 1
Christophe
  • 13
  • 4
  • This has nothing to do with the wildcards, or the function call, or the second expansion; it's what happens when you have a pattern rule with no commands. – Beta Jun 05 '14 at 22:34
  • 1
    Indeed, just adding a ';' at the end of the rule to indicate an empty recipe does the job. – Christophe Jun 06 '14 at 15:46

0 Answers0