Fix EXTERNAL_MODULE_DIRS handling#16103
Fix EXTERNAL_MODULE_DIRS handling#16103gdoffe wants to merge 1 commit intoRIOT-OS:masterfrom cogip:gdo_fix_externals
Conversation
All paths in EXTERNAL_MODULE_DIRS are added to DIRS, making them built even if they are not activated with USEMODULE. Worst, their dependencies are parsed and activated too, leading to build non related modules to the original application. To reproduce, comment "USEMODULE += external_module" in $(RIOTBASE)/tests/external_module_dirs/Makefile: the application build and it should not. To fix this, filter EXTERNAL_MODULE_DIRS with USEMODULE variable. To handle cases where module name is different from its folder name, use sed to extract module name from Makefile and try to find the module in USEMODULE. Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
|
Arf, I forgot to set it as a draft -_-'. |
|
If I recall correctly the reported behavior is exactly as it is intended: If you want to use an external module, you have to add its path to |
|
Ah but that's inconvenient. MODULEDIR ?= $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
KNOWN_EXTERNAL_MODULES = $(foreach md, $(dir $(wildcard $(MODULEDIR)/*/.)), $(shell basename $(md)))
EXTERNAL_MODULE_DIRS += $(addprefix $(MODULEDIR)/, $(filter $(KNOWN_EXTERNAL_MODULES), $(USEMODULE)))in the folder with our external modules. |
|
I'm toying around with changing the interface so that |
It is a bit more than that. Here is the original pull request:
For now it is not as they were in RIOT. If it is modules they have to be submitted to same rules than RIOT modules. Thats a real problem when you build in an external source tree as we do (https://github.com/cogip/mcu-firmware/tree/gdo_test_makefiles) with several possible configurations. Moreover, using the fix, I can develop modules in the RIOT way making them easier to integrate (nearly a copy/paste). Maybe EXTERNAL_MODULE_DIRS is something else, but in that case the example and naming does not follow the intent. |
Well, that is certainly not the case with the implementation provided in that PR. Could you take a look at #16104 ? That PR changes the interface to work similar to |
|
Your PR seems really better than mine. |
Contribution description
All paths in EXTERNAL_MODULE_DIRS are added to DIRS, making them built even if they are not activated with USEMODULE.
Worst, their dependencies are parsed and activated too, leading to build non related modules to the original application.
To reproduce, comment "USEMODULE += external_module" in $(RIOTBASE)/tests/external_module_dirs/Makefile: the application build and it should not.
To fix this, filter EXTERNAL_MODULE_DIRS with USEMODULE variable.
To handle cases where module name is different from its folder name, use sed to extract module name from Makefile and try to find the module in USEMODULE.
I set this PR to draft in case someone could have a better solution.
Testing procedure
Issues/PRs references
I did not create an issue for that as I already have a fix, but I could.