Subject: Re: make seems to find the wrong source file
To: Greywolf <>
From: Simon J. Gerraty <>
List: tech-toolchain
Date: 01/11/2004 17:26:16
If you use the actual example that David provided - it behaves exactly 
as he described:

$ cat /homes/sjg/make-tests/x1
.SUFFIXES: .a .b

all:	   x.b

	@echo "$< -> $@"

x.b: dir/x.a

$ mkdir dir; echo hi > dir/x.a
$ make -f /homes/sjg/make-tests/x1 x.b 
dir/x.a -> x.b

'.' happens to be a bad choice for a value of dir, since in several
places make understands what ./ is.

>It doesn't appear that it will ever build x.a at all unless you have
>an explicit rule for generating it; your ".a.b" rule says "This is how
>I translate .a files into .b files".  Did you, perhaps, mean that it
>would build x.b, not y.b, using the commands from the suffix rule?
>If so, I beg to differ:

If you add an explicit rule for x.b though:

$ cat <<! >> /homes/sjg/make-tests/x1
	@echo "Make $@ from $?"
$ make -f /homes/sjg/make-tests/x1 x.b
Make x.b from dir/x.a

FWIW for the same makefile, gmake will say (without the explicit rule):
gmake: Nothing to be done for `x.b'.
but with the explicit rule it behaves the same as our make.