bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Alex
Subject: A question about make - how does it handle chains of pattern rules?
Date: Thu, 14 May 2009 10:46:27 -0700 (PDT)
User-agent: G2/1.0

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]