On Tue, 2008-02-05 at 11:32 -0800, Derek Clegg wrote:
Given this simple makefile
start: dir/a.c
dir/%.c: %.c | dir ; cp $< $@
dir/%.c: foo.h
dir: ; mkdir $@
a.c foo.h: ; touch $@
I'm seeing the following when I run make:
touch a.c
mkdir dir
cp a.c dir/a.c
This is surprising; my expectation is that the dependency "dir/%c.:
foo.h" would force "foo.h" to be created as well. Is this a bug or
correct behavior?
This is correct.
Pattern rules are not the same as explicit rules: only one pattern
rule
will ever match a given target. Make goes through them in the order
you
define them and whichever one matches first will be used; the rest
will
be ignored.