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: Dmitry Goncharov
Subject: Re: Generating missing depfiles by an automake based makefile
Date: Thu, 9 Feb 2023 16:33:07 -0500

On Wed, Feb 8, 2023 at 11:54 AM Jan Engelhardt <jengelh@inai.de> wrote:
> depfiles are created ahead of make so that the include command
> in Makefiles succeeds (include-with-ignore is non-portable AFAIR).

Atleast, gnu make and sun make can build included files.


> depfiles are not specifically tracked; this is impossible,
> due to a chicken-egg problem.

Do you mean this is impossible when we have to support some specific make impl?

> .Po file contents control when an .o file -- and thus also
> the .Po file itself -- is remade.
> If a .Po file has no practical content, there is no indication
> that it needs to be remade.

Absence of the depfile is such an indication.
Here is a sample bash session which demonstrates how gnu make and sun
make are able to build a missing depfile.

$ ls
hello.c  hello.h  makefile
$ cat makefile
all: hello.tsk
hello.tsk: hello.o
        gcc-10 -o $@ $^

hello.o: hello.c hello.Po
        gcc-10 -c hello.c -MD -MF hello.Po

hello.Po:
        gcc-10 -c hello.c -MD -MF hello.Po

include hello.Po
$ gmake
gcc-10 -c hello.c -MD -MF hello.Po
gcc-10 -o hello.tsk hello.o
$ gmake
gmake: Nothing to be done for 'all'.
$ rm hello.Po
$ gmake
gcc-10 -c hello.c -MD -MF hello.Po
gcc-10 -o hello.tsk hello.o
$ gmake
gmake: Nothing to be done for 'all'.
$ rm hello.o hello.Po hello.tsk
$
$
$ # this is sun make
$ /bin/make
gcc-10 -c hello.c -MD -MF hello.Po
gcc-10 -o hello.tsk hello.o
$ /bin/make
$ rm hello.Po
$ /bin/make
gcc-10 -c hello.c -MD -MF hello.Po
gcc-10 -o hello.tsk hello.o
$ /bin/make
$

In the case of gnu make the rule to build the depfile does not have to
have a recipe and can be simplified to
hello.Po:

Which implementations of make does automake generate makefiles for?
Can automake be enhanced to generate gnu make specific code to allow
for depfiles to be rebuilt? Such enhancement can be conditional, that
is, only when the generated makefile is supposed to be used with gnu
make. Same for sun make.

regards, Dmitry



reply via email to

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