bug-make
[Top][All Lists]
Advanced

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

Re: Generating missing depfiles by an automake based makefile


From: Edward Welbourne
Subject: Re: Generating missing depfiles by an automake based makefile
Date: Fri, 10 Feb 2023 12:55:50 +0000

Dmitry Goncharov (10 February 2023 00:24) wrote:
> When a depfile is missing (for any reason) the current automake
> makefile creates a dummy depfile.

This seems misguided.
Better to

  include $(wildcard $(DEPFILES))

instead, so there are no misleading depfiles lying around to cause make
to fail to make them when needed.

As long as depfiles are created as a side-effect of creating the target
they describe, absence of the depfile usually implies absence of that
target, so there's no need to know what it depends on because you need
to recreate it anyway.

A more robust version of that is, taking the example of .o files as the
targets, to

EXTANT_OBJS := $(wildcard $(OBJECTS))
DEPFILES := $(EXTANT_OBJS:%.o=%.dep)
include $(DEPFILES)

so that if a target does exist, we do insist on regenerating its
depfile, even if that means regenerating the target itself.  We don't
know the target's dependencies, so we don't know that it is up to date,
so this isn't unreasonable, for all that it might turn out to have been
up to date, after all.

> From that point on the user has to notice that make is no longer
> tracking dependencies and their build is incorrect.

The issue here is creation of dummy depfiles.
Don't Do That.

        Eddy.



reply via email to

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