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: Tassilo Horn
Subject: Re: File only generated every 2nd run of make
Date: Tue, 27 Jan 2015 13:48:01 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Paul Smith <address@hidden> writes:

Hi Paul,

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

I now use a recursive make to call the gnus-load.el target after clean
targets.  That works fine.

Thanks,
Tassilo




reply via email to

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