Re: this is embarrasing... prerequisiste gets updated, but make still sa

From:

Paul Smith

Subject:

Re: this is embarrasing... prerequisiste gets updated, but make still says it is older than target

Date:

Mon, 02 Apr 2012 07:52:47 -0400

On Sun, 2012-04-01 at 23:35 -0700, Mark Galeck (CW) wrote:
> This is a major blow to my self-esteem :) I don't understand how make
> works.... prerequisite foobar1 gets updated, but make still says it
> is older than the target foobar, so does not remake the target.
It's because your makefile is not telling the truth; make is pretty
pedantic about that.
> foobar: foobar1
> touch $@
>
> foobar1: foobar_phony
>
> .PHONY: foobar_phony
> foobar_phony:
> touch foobar1
So here you have a rule (foobar_phony) where the recipe doesn't create
the target it said it would, AND it creates some other target instead.
Make basically tells you all you need to know right here:
> Successfully remade target file `foobar_phony'.
> Finished prerequisites of target file `foobar1'.
> Prerequisite `foobar_phony' of target `foobar1' does not exist.
> No commands for `foobar1' and no prerequisites actually changed.
> No need to remake target `foobar1'.
So make ran the rule to rebuild the target foobar_phony, but the target
was not changed, and in fact doesn't exist. Then make notes that there
is no recipe for the "foobar1: foobar_phony" target, so obviously
there's nothing here that would cause foobar1 to be updated. Make sees
that there is nothing that could have updated foobar1, so it doesn't
need to rebuild foobar either.
There are a number of ways to fix this. You could add an empty recipe
for "foobar1: foobar_phony". You could change the phony rule. Etc.
However the above pseudo-code is nonsensical; you obviously have some
esoteric behavior you're trying to encode here but without knowing the
details it's impossible to provide useful guidance.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.orghttp://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist