help-make
[Top][All Lists]
Advanced

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

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


From: Paul Smith
Subject: Re: Makefile problem: Up to date, when it really isn't
Date: Fri, 02 Oct 2009 08:34:35 -0400

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
file.

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
        mburn:
                $(MAKE) -s -C $@

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




reply via email to

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