RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

Makefile.{include,base},pkg/nanopb: fix target deps & code generation

Open DanielLockau-MLPA opened this issue 1 year ago • 0 comments

Contribution description

This PR aims to

  • make the results of GENSRC available to all modules (and be robust against multiple dependencies against the same protobuf schema)
  • compile protobuf schema outside the current directory without caring much about the shortcomings of protoc

To achieve that

  • The GENSRC target is moved into a more central place. Before, it did run on every module build. GENSRC is known already much earlier and can be run once for all modules. This PR suggests to run it once after pkg-prepare.
  • The output of nanopb is put into a central place in $(BINDIR)/nanopb to make it accessible to all modules which depend on nanopb. While not normally required, this allows for multiple modules using the generated sources. Without the changes of this PR the options for usage by multiple modules was to live with a race condition during build because one module (the application) would generate sources which another one then wanted to use for compiling. Naming of the same protobuf dependency by multiple modules would lead to multiple definitions of the same symbols.

Testing procedure

none

Issues/PRs references

none

DanielLockau-MLPA avatar Feb 19 '24 13:02 DanielLockau-MLPA