RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

build-system: auto-locate modules by name

Open maribu opened this issue 4 years ago • 10 comments

Contribution description

This PR introduces the MODULE_DIRS variable that works just like EXTERNAL_MODULE_DIRS, but it is intended for internal modules. The major difference is that external modules can have the same name as an internal module, in which case the external module is used instead of the internal one. This allows to provide drop-in replacements of internal modules, which can be useful during development e.g. to quickly benchmark different implementations.

Testing procedure

All applications for all boards should still build and yield identical binaries.

Issues/PRs references

Follow up of https://github.com/RIOT-OS/RIOT/pull/16104

maribu avatar May 10 '21 15:05 maribu

This only works with modules in a directory matching the module name right?

fjmolinas avatar May 21 '21 11:05 fjmolinas

This only works with modules in a directory matching the module name right?

Exactly. For those modules, one still has to manually add the dirs to the DIRS variable. But e.g. for all modules in drivers, this already works.

maribu avatar May 21 '21 12:05 maribu

This only works with modules in a directory matching the module name right?

Exactly. For those modules, one still has to manually add the dirs to the DIRS variable. But e.g. for all modules in drivers, this already works.

Can this be documented?

fjmolinas avatar May 21 '21 13:05 fjmolinas

This only works with modules in a directory matching the module name right?

Exactly. For those modules, one still has to manually add the dirs to the DIRS variable. But e.g. for all modules in drivers, this already works.

Can this be documented?

BTW, couldn't we do the same for external modules as well?

fjmolinas avatar May 21 '21 13:05 fjmolinas

This only works with modules in a directory matching the module name right?

Exactly. For those modules, one still has to manually add the dirs to the DIRS variable. But e.g. for all modules in drivers, this already works.

Can this be documented?

BTW, couldn't we do the same for external modules as well?

Yes, but at least one external module has to be found without, which could extend the DIRS variable as needed. (Or the applications Makefile could do so.)

I intend btw. to extend the mechanism to allow assigning prefixes to search dirs. E.g sys/gnrc should find module gnrc_%, where % is the folder name. With this, we might be able to automatically locate all modules eventually.

maribu avatar May 21 '21 14:05 maribu

Do you think this should be included in this coming release or should we push it?

MrKevinWeiss avatar Jun 22 '21 15:06 MrKevinWeiss

Needs a rebase (feel free to squash while you're at it)

benpicco avatar Oct 19 '21 20:10 benpicco

Module names that mix the directories into it are a common practice in the build system, e.g.: foo/bar and MODULE = foo_bar.

That should actually be possible to still auto-detect, as long as the pattern is consistent. I have an idea how this might be possible to implement in make without complexity getting too high.

maribu avatar Oct 20 '21 12:10 maribu

@maribu, ping!

OlegHahm avatar Mar 09 '22 13:03 OlegHahm

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

stale[bot] avatar Sep 21 '22 05:09 stale[bot]

Let's close this. It is so outdated that one would need to start from scratch anyway. And maybe after the KConfig migration we can switch to a better build system instead :)

maribu avatar Jan 02 '23 20:01 maribu