I've vaguely wanted this in the past, glad someone is interested and
motivated enough to get their hands dirty :)
Assuming you're interested in doing this only for C++, you'd want to make
the changes in the capnpc-c++ code generator plugin. Maybe Kenton can
provide more specific guidance than this, since I'm not familiar with
that part of the codebase. But at a high level, the main schema compiler
is going to feed that program a CodeGeneratorRequest as defined in
schema.capnp. RequestedFile.imports should have the information you need
to generate dependencies.
A possible alternative wuold be to write a (separate) schema compiler
plugin that just dumps the input to a file (say foo.capnp.cgr) and also
generates Makefile stubs for that file; you could then feed in the
generated file to capnpc-c++ (or other plugins) manually, and add
rules like:
%.capnp.cgr: %.capnp
# ...
%.capnp.h %.capnp.c++: %.capnp.cgr
# ...
This would be more general, and might be a little easier.
Note that one thing that's a little sad about gcc's -M is that it will
fail if the file doesn't exist, so you can't use it to gather dependencies
for the *.capnp.{h,c++} files as easily as you can non-generated files.
-Ian
Quoting Dirk Jagdmann (2021-08-05 11:50:58)
> --
> You received this message because you are subscribed to the Google
> Groups "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [1]
capnproto+...@googlegroups.com.
> To view this discussion on the web visit
> [2]
https://groups.google.com/d/msgid/capnproto/b5ffcffe-5a2f-45d4-b248-
> 58118947c67dn%
40googlegroups.com.
>
> Verweise
>
> 1. mailto:
capnproto+...@googlegroups.com
> 2.
https://groups.google.com/d/msgid/capnproto/b5ffcffe-5a2f-45d4-b248-58118947c67dn%40googlegroups.com?utm_medium=email&utm_source=footer