Reputation: 6856
I encountered some strange behavior, when one runs
make hello-there
and the makefile is
hello-%:
@echo hi $*
I get
hi there
But when the makefile is just
hello-%:
I get
make: *** No rule to make target `hello-there'. Stop.
Upvotes: 0
Views: 26
Reputation: 496
In the second case you are not definign any rule for hello-%
.
From chapter 5 of the documentation:
Each line in the recipe must start with a tab, except that the first recipe line may be attached to the target-and-prerequisites line with a semicolon in between
You have to ways of solving this:
Add a semicolon at the end of the line defining the target name:
hello-%: ;
Add a line containing only a tab below the the one defining the target name
Upvotes: 1