Reputation: 9775
I'm experimenting with some semi-literate programming, and need to build some files that have no .extension. I'd like to use a generic patter in my Makefile, but can't get it to work.
Here's my Makefile, reduced to an MWE:
all: jcb jcbsetup
jcbsetup: jcb.org
%.: %.org
./weborg2asm.awk $< > $@
In this case, make -B
says "nothing to be done"
If I try changing %.:
to % :
, it builds only jcb, not jcbsetup.
Obviously, I can code the recipe for each explicit target, but for obvious reasons I'd like to use a pattern. I can (sort of) understand why this doesn't work, but is there something that does work?
I'm using Gnu Make 4.0, under cygwin.
Upvotes: 0
Views: 112
Reputation: 12514
As shown, this shows how to build jcb.
from jcb.org
, and says nothing about jcb
.
If (as looks correct) you change the rule to %: %.org
then that would appear to do the correct thing, and your makefile is doing what you asked.
Note that your target jcbsetup: jcb.org
doesn't have any actions, and therefore it's saying that "when jcb.org
is made, then jcbsetup
is up-to-date, too", and it won't do anything extra to make jcbsetup
.
If you have a jcbsetup.org
, then the %: %.org
would match, and this would indicate how to create jcbsetup
from jcbsetup.org
. But this would happen only in this case.
Note that it's usual for the pattern rules (involving %
) to go before the first concrete rule; they may not be recognised afterwards (even if they are, it's more conventional/readable for them to go first).
Upvotes: 1