[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Pattern rules without recipe
From: |
Frank Heckenbach |
Subject: |
Pattern rules without recipe |
Date: |
Fri, 09 Jun 2023 09:39:21 +0200 |
Another thing that surprised me which I assume is working as
designed, but I think should be spelled out clearer in the manual:
% cat Makefile
MAKEFLAGS += --no-builtin-rules
.PHONY: %.a %.b %.c
%.a: ; @echo $@
%.b: %.a; @echo $@
%.c: %.a
% make x.b x.a
x.b
% make x.c
make: *** No rule to make target 'x.c'. Stop.
It took me a while to understand what's going on. If I understand it
correctly now, '%.c: %.a' doesn't actually define a pattern rule,
but cancels a (nonexisting) built-in rule, as per 10.5.6.
That's not obvious in 10.5 where pattern rules are introduced. In
fact, the example given there is just of this form:
: Thus, a pattern rule '%.o : %.c' says how to make any file stem.o
: from another file stem.c.
I think that should be '%.o : %.c; recipe ...', like in 10.5.1.
Even 10.5.1 doesn't (but IMHO should) say explicitly that a recipe
is required (even a dummy will do, i.e. just a ';' after '%.c: %.a')
to actually form a pattern rule.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Pattern rules without recipe,
Frank Heckenbach <=