help-make
[Top][All Lists]
Advanced

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

Re: File only generated every 2nd run of make


From: Paul Smith
Subject: Re: File only generated every 2nd run of make
Date: Mon, 26 Jan 2015 09:14:27 -0500

On Mon, 2015-01-26 at 08:30 +0100, Tassilo Horn wrote:
> But when I do it again, I get
> 
>   % make clean-some gnus-load.el
>   rm -f *.elc gnus-load.el auto-autoloads.* custom-load.*
>   make: 'gnus-load.el' is up to date.
> 
> Huh?  How can gnus-load.el be up to date?  You've just deleted it...

This has never been valid.  If it worked before it was just chance.

Make maintains an internal cache of the contents of directories, for
performance reasons.  It only updates that cache with changes that it
knows about, and it only knows about changes because a make rule told it
that the change happened (that is, there was a target that make wanted
built and it ran a recipe to get it built, then make updates its cache
to understand that the file was built (or not)).

In your case you have a target "clean-some", which deletes files which
have nothing to do with the target "clean-some", so make doesn't know
that they are gone.  If they already exist in make's cache then they
will still exist there, and make will think that they are up to date.

If you want to do this reliably you MUST run two separate make commands:

  make some-clean && make gnus-load.el

Alternatively you can have a "rebuild" rule, or something, that does the
same thing via recursive make:

  .PHONY: rebuild
  rebuild:
          $(MAKE) some-clean && $(MAKE) gnus-load.el





reply via email to

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