Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A question about make - how does it handle chains of pattern rules?

3 views
Skip to first unread message

Alex

unread,
May 14, 2009, 1:46:27 PM5/14/09
to
Hello,

My question is about make. I have the following makefile:

DIR=$(HOME)
L0=$(DIR)/0
L1=$(DIR)/1
L2=$(DIR)/2

$(L0)/%: $(L1)/%
@echo 'Rule #1 ---- ($@) to be made from ($<)'

$(L1)/%: $(L2)/%
@echo 'Rule #2 ---- ($@) to be made from ($<)'

$(L2)/%:
@echo 'Rule #3 ---- ($@)'

I've created a directory '2' in my home and a some file 'x' there:

cd ~
mkdir 2
touch 2/x

then I call the make 3 times:

(1) make -r ~/2/x
(2) make -r ~/1/x
(3) make -r ~/0/x

First case: it reports that the file is up-to-date - all is correct.
Second case: it find the pattern Rule #2 - all is correct as well.
Third case is a problem - the make can't find the Rule #1. The
question - why? Is it a bug or a feature?

By the way, if to assign a current directory to the DIR variable in
the above makefile:

DIR=.

then the make WILL find the Rule #1 in the third case

Any comments are appreciated

Version is:

GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.

Thanks,
Alex

Andreas Schwab

unread,
May 15, 2009, 5:17:31 AM5/15/09
to Alex, bug-gn...@gnu.org
Alex <yako...@hotmail.com> writes:

> Third case is a problem - the make can't find the Rule #1. The
> question - why? Is it a bug or a feature?

Works for me. I'm using make 3.81.

Andreas.

--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Alex

unread,
May 15, 2009, 10:51:52 AM5/15/09
to
On May 15, 5:17 am, Andreas Schwab <sch...@linux-m68k.org> wrote:

Andreas, thank you.
I've downloaded the 3.81, built it and ran it - it worked fine
--
Alex

Alex

unread,
May 21, 2009, 8:58:10 PM5/21/09
to
Hello again,

It looks like the make 3.81 contains a bug. My makefile is a simple
two-liner:

//%: //%
@echo oops!

(I know, that double slash is not what people normally use, but this
string might appear after string substitutions. BTW, the '//name' is a
valid syntax)

The make 3.81 chokes on the makefile above, if and only if the
makefile is defined as an absolute pathname. I mean, that

make -r -f $HOME/path/to/myMakefile xyz

produces a very long error message, mostly consisting of slashes,
complaining about too long filename (of the makefile), and it takes
significant time. The case

cd $HOME/path/to
make -r -f myMakefile xyz

works fine.

BTW, the make 3.80 works normally in both cases

All the best
Alex

0 new messages