Background

For the translation of programs with C++ modules, the use of special build systems is necessary. The dependency information for modules that gcc currently generates in the make format (options -M -MD..) have led to some open error messages (109718, 105467, 120103)
and do not seem to be a satisfactory solution.
For build systems, module dependencies in JSON format have been introduced.
The following proposal describes the generation of module dependencies in make format. This makes it possible to translate C++ projects with modules using GNU Make scripts alone,
similar to classic dependency analysis with make and gcc option -M etc



Proposal

1. (gcc) The current available header dependency information are used as is.
2. (gcc) Add the dependencies on imported modules in form of a variable. (CXX_MOD_<module name>_CMI) 3. (gcc) Add information about which source file exports which module in form of a list. (CXX_SRC_MOD_IF_LIST) 4. (gcc) A new format in option -fdeps-format activates the module dependency information. With this information provided from gcc the make scrip is able to obtain all necessary dependency information.
5. (make script) Add rules for the generation of the dependency files.
6. (make script) Import the generation dependency files.
7. (make script) Walk through the source module list and emit variables with the module to CMI file link. 8. (make script) Walk through the source module list and generate the rules for the translation of the units with modules
as grouped target rules with the object file and the CMI file as target.
9. (make script) Generate the rules for the remaining non-module sources as usual. 10. (make script) Enable secondary expansion for the prerequisites of the dependency rules.

You can find a longer description here: https://github.com/joergboe/MakeItSimple/discussions/8 (Chapter: The Build Process with C++ Modules)

Reply via email to