bug-make
[Top][All Lists]
Advanced

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

prerequisites alter choice of pattern match rules?


From: Brian J. Murrell
Subject: prerequisites alter choice of pattern match rules?
Date: Mon, 25 Feb 2013 08:57:49 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

Hi,

I have run into something I find strange with GNU Make 3.81 (yes, I know
3.82 is latest but since it's not in EL6, my target platform, I cannot
depend on it's features).

I would think that given the following set of rules:

/tmp/%.foo: %.foo
        echo "foo rule 1"
        touch $@

%.foo:
        echo "foo rule 2"
        touch $@

/tmp/%.bar:
        make $*.bar
        echo "bar rule 1"
        touch $@

%.bar:
        echo "bar rule 2"
        touch $@

Trying to create a target of /tmp/a.foo and /tmp/a.bar should result in
the same rules being run but they don't:

$ ls -l . /tmp/a.bar /tmp/a.foo
ls: cannot access /tmp/a.bar: No such file or directory
ls: cannot access /tmp/a.foo: No such file or directory
.:
total 4
-rw-rw-r--. 1 brian brian 176 Feb 25 08:48 Makefile
$ make /tmp/a.foo
echo "foo rule 2"
foo rule 2
touch /tmp/a.foo
$ make /tmp/a.bar
make a.bar
make[1]: Entering directory `/home/brian/chroma/deps/lustre/test'
echo "bar rule 2"
bar rule 2
touch a.bar
make[1]: Leaving directory `/home/brian/chroma/deps/lustre/test'
echo "bar rule 1"
bar rule 1
touch /tmp/a.bar

It would seem that for the /tmp/a.foo, the "/tmp/%.foo" pattern rule is
not being chosen but for /tmp/a.bar" the "/tmp/%.bar" pattern rule is
being chosen.  The only difference in those choices I can see is that
the "/tmp/%.foo" pattern rule has a prerequisite and the "/tmp/%.bar"
one doesn't.

So the question is, why does a prerequisite change the behavior of
pattern match rules?  I would think the selection of a pattern match
rule would be independent of prerequisites but of course once the
pattern match rule was chosen, the rule for the prerequisite would also
need to be called to ensure it's freshness.

Thoughts?

b.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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