Hi!
is there a way to include subdirectory sources into a module without creating a submodule? I think I could use DIRS += orbits
but that’d create a submodule, or am I holding it wrong? I’d also really like to avoid creating a separate Makefile for each subfolder.
SRC := houston.c fuel.c orbits/moon.c orbits/earth.c
doesn’t work, unfortunately.
space_module
|
+-- Makefile
+-- houston.c
+-- fuel.c
+-+ orbits
|
+-- moon.c
+-- earth.c
@mikolai has a PR open that would implement support for this.
But frankly: I doubt there is a real use case for this. If the code is too large to comfortable navigate it when all source files are in a single folder, it will be hell of a beast of a module. At that point my first reaction would be to suggest splitting that module. Smaller modules increase the chance that code actually can be reused across other modules.
E.g. you won’t add a dependency to driver_foo
from driver_bar
just for the pretty convenient utility function in driver_foo
, but likely copy-paste the code from driver_foo
to driver_bar
. But if that utility function would be split out into a driver_utils
module, letting driver_bar
depend on that does make a lot of sense.