On Wed, 15 Sept 2021 at 10:46, Klaus Rudolph wrote: > > If we want to use import <iostream>; instead of old style #include > <iostream> we need to "precompile" the iostream header file. We can do > it manually by simply invoking g++ with: > > g++ -xc++-system-header -std=c++20 -fmodules-ts iostream > > But this needs a manually created set of rules for all used system > header files for gnu make with all the dependencies pointing to the > gcm.cache directory structure. > > In case of old style #include directives, we simply have the -M or -MM > flags to generate such dependencies for make automatically. > > Q: How we can get such dependencies from g++ for imported modules > automatically to set up the rules for gnu make? > > The target is quite simple: Get all needed .gcm files precompiled before > the build system needs these files for import. The expected process is to get Make to do that for you, not to set it all up in advance. But it's just a proof of concept so far, see the last paragraph of https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html I think there is no solution to the problem using the current released versions of the tools, you have to do it all manually.