If I create a Makefile:

--8<--
.PHONY: all
all:
        : late

.PHONY: /dev/null .early-generation
/dev/null: .early-generation
include /dev/null

.early-generation:
        : early
-->8--

when run on GNU Make 4.3[1] the output is:

 : early
 : late

whereas when run on GNU Make 4.4.1 the output is just:

 : late

If I change the middle part to:

--8<--
.PHONY: .early-generation
.real-file: .early-generation
include .real-file
-->8--

then the output from 4.4.1 matches that of 4.3. Strangely there's no
complaint that .real-file doesn't actually exist.

It looks like this change is probably a result of
https://savannah.gnu.org/bugs/?60795 in
0c2fc00544b89314643561dcb6d78f35eb98da68.

If this method is no longer supported, what is the preferred way to ensure
that generated files are built in a separate step before Make considers
which targets are out of date during the main build?

Can we rely on the .real-file method described above continuing to work?

Thanks.

Mike.

[1] The original Makefile using this construct was written for Make 3.81 in
    2010 and I believe that it worked from then until at least Make 4.3.

  • Inclusion of .PHONY... Mike Crowe via Bug reports and discussion for GNU make

Reply via email to