C++ Logo


Advanced search

Re: P2898R0: Importable Headers are Not Universally Implementable

From: Ben Boeckel <ben.boeckel_at_[hidden]>
Date: Thu, 1 Jun 2023 12:23:42 -0400
On Tue, May 30, 2023 at 22:05:22 +0200, Mathias Stearn via SG15 wrote:
> So I did a bit of digging and I now think it is possible to get restat-like
> behavior out of make. The "trick" is to use a separate recursive make
> invocation for scanning vs building. So for example, in your user-facing
> Makefile, you will have entries like this:
> all:
> $(MAKE) -f Makefile2 scan_all
> $(MAKE) -f Makefile2 build_all
> .PHONY : all
> The scan_all task will do all of the scanning (possibly by defering to sub
> tasks if you aren't using a megascan approach) and then exit that instance
> of make. The build_all task will run with a new instance of make, so it
> won't see that the scanning tasks were considered dirty and will only look
> at the mtimes of the outputs. If the scan_all task (and its dependencies)
> only touch files whose outputs have changed, then the downstream build
> tasks will not need to rerun.

This does not support generated sources from tools that you're building
in this project (protobuf, VTK's wrapper code, etc.). You need to
schedule a scan of *these* sources after building other code (assuming
they use `import`). FWIW, this is why this scan/build split is done
per-target in CMake (there's another level of recursive make to stitch
the per-directory user interface in front of all of that).


Received on 2023-06-01 16:23:44