[Top][All Lists]

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

Re: Makefile problem: Up to date, when it really isn't

From: Peter Belm
Subject: Re: Makefile problem: Up to date, when it really isn't
Date: Fri, 2 Oct 2009 14:06:53 +0100

Thank you, I didn't realize Make operated on directories like that, but now it makes sense. I've added it to my .PHONY line and it's working now.

On Fri, Oct 2, 2009 at 1:34 PM, Paul Smith <address@hidden> wrote:
On Fri, 2009-10-02 at 12:45 +0100, Peter Belm wrote:
> {projectdir}/makefile
> {projectdir}/mburn/makefile
> In the root makefile I have this target:
>         mburn:
>             $(MAKE) -s -C $(WORKROOT)/mburn

> If I run "make" in the mburn directory it tries to compile (it fails
> because it's broken), but if I make sure there's no .o files and no
> binary, then run "make mburn" in the top directory, it says "make:
> `mburn' is up to date.". Which it clearly isn't if it doesn't have the
> binary file.

Make checks targets, which are entries in the filesystem, to see if
they're out of date.  Out of date-ness is determined by comparing the
time last modified of the entry in the filesystem against any
prerequisites defined in the makefile.

Here you have a target of "mburn".  What is mburn?  It's a directory.
However, a directory is STILL a filesystem element; it still has a time
last modified and make treats directories just like it would any other

And, in this case, "mburn" has no prerequisites.  So, as long as it
exists make won't try to remake it.

In this case make will NEVER try to rebuild inside the "mburn" directory
because the "mburn" directory already exists.

Most likely what you want to do is add a .PHONY to declare that make
should assume that the "mburn" directory is NEVER up to date, and will
always try to build it:

       .PHONY: mburn
               $(MAKE) -s -C $@

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Peter Belm

reply via email to

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