bug-make
[Top][All Lists]
Advanced

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

bug with order-only prerequisites & implicit rules implementation ?


From: Jason Vas Dias
Subject: bug with order-only prerequisites & implicit rules implementation ?
Date: Sun, 11 Jan 2015 03:09:44 +0000

Greetings -

Please could anyone explain the behaviour of this test makefile (attached) :

<quote><code>
TMP:=/tmp

%.ext:
        touch $@

.PHONY: *.oop
%.oop:
        @echo 'A phony order-only prequisite of /tmp/a.t';

#$(TMP)/%.t: | %.oop

$(TMP)/%.t:$(TMP)/%.ext | %.oop
        @echo Specific Rule

%.t:%.ext
        @echo General rule

</code></quote>

when invoked with :

  $ make -f ${the_makefile} /tmp/a.t

I would expect that the most specific matching first rule
would be invoked always, with its extra order-only
pre-requisite recipe always being invoked, but actually
this occurs only if /tmp/a.ext does not already exist -
I tested latest make-4.1, and make-3.82, on a RHEL6 linux
platform,  and both show the same behaviour:

$ make -f ${the_makefile} /tmp/a.t
touch /tmp/a.ext
A phony order-only prequisite of /tmp/a.t
Specific Rule
rm /tmp/a.ext

but if I :
$ touch /tmp/a.ext
and then :
$ make -f ${the_makefile} /tmp/a.t
Gemeral Rule

If I remove the phony order only dependency. so that the /tmp/%.t rule reads:
<quote><code>
$(TMP)/%.t:$(TMP)/%.ext
</code></quote>
then the makefile always runs the first recipe, regardless of the existence
of /tmp/a.ext :
$ make -f ${the_makefile} /tmp/a.t
Specific Rule
$ touch /tmp/a.ext
$ make -f ${the_makefile} /tmp/a.t
Specific Rule
$ rm /tmp/a.ext
$ make -f ${the_makefile} /tmp/a.t
touch /tmp/a.ext
Specific Rule
rm /tmp/a.ext

Also, a second problem is that order-only dependencies are not
recognized when specified by multiple rules without recipes are
specified  for same target , ie:
<quote><code>
$(TMP)/%.t: | %.oop
$(TMP)/%.t:$(TMP)/%.ext
</quote></code>
has the same effect (recipe for implicit order-only pre-requisite never runs)
as no order-only dependency being specified at all. I thought the
dependencies should be merged and the %.oop recipe should be run in
this case, especially as I've told make that all *.oop targets are
phony.

Is this a bug with make ?

Any responses much appreciated.

Thank You & Regards,
Jason Vas Dias



reply via email to

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