-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Makefile.dep: auto_init_% as DEFAULT_MODULES #13089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile.dep: auto_init_% as DEFAULT_MODULES #13089
Conversation
I removed now all |
Ups I had |
BTW this should wait for the release to be over. |
6a4a3e8
to
4d5ddfb
Compare
Rebased. |
I'll also add |
I'll do a separate PR for this, murdock already on this one so it should be ok as is, |
Makefile.dep
Outdated
@@ -1038,6 +1036,64 @@ ifneq (,$(filter devfs_random,$(USEMODULE))) | |||
USEMODULE += random | |||
endif | |||
|
|||
ifneq (,$(filter auto_init,$(USEMODULE))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to move this to a separate file?
Makefile.dep
Outdated
@@ -1038,6 +1036,64 @@ ifneq (,$(filter devfs_random,$(USEMODULE))) | |||
USEMODULE += random | |||
endif | |||
|
|||
ifneq (,$(filter auto_init,$(USEMODULE))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to turn this into a loop.
Something like
HAS_AUTO_INIT += foo \
bar \
#
ifneq (,$(filter auto_init,$(USEMODULE)))
DEFAULT_MODULE += $(patsubst %,auto_init_%,$(filter $(HAS_AUTO_INIT),$(USEMODULE))
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe additionally filter on DISABLED_MODULES
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HAS_AUTO_INIT += foo \ bar \
where would this be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in Makefile.dep
for now is fine, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be to have, for every module that uses auto_init, a dependency block:
ifneq (,$(filter foo,$(USEMODULE)))
ifneq (,$(filter auto_init,$(USEMODULE)))
DEFAULT_MODULE += auto_init_foo
endif
endif
This way, the information is "closer" to the module's dependency info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the HAS_AUTO_INIT
because these function do not allways match a module name which makes it kind of weird. These HAS_AUTO_INIT
would IMO have to be in the modules MAKEFILE
, but some of these MODULES
are not pseudomodules, so it isn't a HAS_AUTO_INIT
but use this MODULE
s init
function in a way, and there isn't a MODULE
<->auto_init
naming match in all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why "later in the file"?
in order to know all modules with potential auto_init support. but since this file is included transitively, this doesn't make much sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So which style is prefered @aabadie @kaspar030?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me,
ifneq (,$(filter foo,$(USEMODULE)))
DEFAULT_MODULES += auto_init_foo
...
endif
... together with some logic so that if auto_init is disabled, all auto_init_% are also disabled.
tests/periph_rtt/Makefile
Outdated
@@ -3,6 +3,4 @@ include ../Makefile.tests_common | |||
|
|||
FEATURES_REQUIRED = periph_rtt | |||
|
|||
DISABLE_MODULE += auto_init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be removed this is still called, since init_rtt
is not in auto_init
I've removed the discussion label, I think there's consensus this is a nice idea. |
aefb068
to
ef76fe4
Compare
Rebased to fix conflict. |
ef76fe4
to
c830260
Compare
Declaring all auto_init_% modules as pseudomodules will allow using auto_init_% modules as modules that can be disabled. This will give a higher lever of granularity allowing users to not disable the complete auto_init module but only some of them.
Currently default modules resolution is only performed in Makefile.include. This avoids DEFAULT_MODULES being declared in Makefile.dep since they never become USEMODULE. Duplicate at the end of the dependency resolutiion after recursive cach of transitive depdencies since at this stage DEFAULT_MODULES can't and SHOULD NOT trigger depedency resolutions.
Having the modules as DEFAULT_MODULES allows disabling them.
c830260
to
e0855de
Compare
@kaspar030 @aabadie can you check if all is OK for you, this one diverges quickly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Nice change!
DEFAULT_MODULE += auto_init_gnrc_sixlowpan | ||
USEMODULE += sixlowpan | ||
DEFAULT_MODULE += auto_init_gnrc_sixlowpan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for adding auto_init_gnrc_sixlowpan
twice?
I think those were added twice by accident. This cleans that up. introduced by RIOT-OS#13089
Contribution description
This PR looks to extend the granularity of
auto_init
MODULES. Currently onlyauto_init
is aDEFAULT_MODULE
which means its the only one that can be disabled, which translates into, get everything or nothing. As a user I could want to only deactivate one of thisauto_init
modules and keep the rest (for examples in ourtests
).This PR wan't to achieve this by declaring all curent cases of
USEMODULE += auto_init_%
asDEFAULT_MODULE += auto_init_%
, it also by default declares allauto_init_%
as pseudomodules (except for those that are not).As an example I add an
auto_init_xtimer
module and changes the gauards inauto_init.c
to reflect this. IMO this could be done for all modules inauto_init
, but that would mean a lot of changes, so maybe better to introduce when needed?Testing procedure
green murdock
try disabling a module, I added a
#error
in:and compiled with and without disabling
DISABLE_MODULE+=auto_init_xtimer make -C tests/xtimer_usleep
Issues/PRs references
Though of this because of #13052