C++ module support

Lee Magnusson <[email protected]> Sun, 11 May 2025 06:12:07 -0700
Newsgroups gmane.comp.gnu.make.general
Message-ID <CAKAko5YnWvoH7-LDod8q5-gMYmoEHyAM95N0dOhy3nm+EcNpPg@mail.gmail.com>
I'm interested in converting a project to using c++ modules. I found that
when using the -MMD -MP flags g++ currently produces make dependency files
that look like this:
hellworld.d:
helloworld.o gcm.cache/helloworld.gcm: helloworld.cpp old.h
old.h:
helloworld.c++-module: gcm.cache/helloworld.gcm
.PHONY: helloworld.c++-module
gcm.cache/helloworld.gcm:| helloworld.o

main.d
main.o: main.cpp gcm.cache/helloworld.gcm
gcm.cache/helloworld.gcm:
main.o: helloworld.c++-module
CXX_IMPORTS += helloworld.c++-module

In the latest build of gcc the suffix is .c++-module shown above. In
earlier versions it's c++m. These dependency files work ok in that they do
create rebuilds of the helloworld.cpp file when there are changes. But they
also force a rebuild of main on every run. Is there a suggestion on how to
use these dependency files at the current time?