-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Introduce module vars #10928
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
Introduce module vars #10928
Conversation
As it is an RFC, I put remarks here as I find it better than inline. I like the idea and thought about it already. Having the "target" name in the variable is make way to provide namespaces. One technical thing, not sure if good or bad, the separator For the implementation detail, I am not in favor of the magic part with the
as it hides where a variable is defined and is harder to grep for all things changing a variable. |
Good point. My first reaction is "good".
What would you propose? |
Be explicit with I would then easily find all things defining CFLAGS with only One thing I just think about, some definitions may not be suitable to be set like this when the definition order matters. Not blocking or anything just need to be documented that they should work with any definition order. |
Pro's and cons. That would lead to:
... with probably a growing number. It would also remove the possibility to add variables from within other files, but have them collected at a defined point.
Same with using a helper, you'd find CFLAGS mentioned as being added to MODULE_VARS. |
Wouldn't it be simpler (and more modular) if modules had their CFLAG modifications, etc in their own Makefile.include, which would then be included only if the module is included? To expand on this idea: instead of having a foreach that does eval, one has a "include" and a foreach to get the paths of the Makefiles.include to include. The eval thing is self-modifying code (the include maybe too, but in a more controllable and debuggable way.) |
It's good to know about this, but I withdraw the request for review for me, since I don't have much to say on this issue. |
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. |
Contribution description
Currently, if a module wants to add to the global CFLAGS et al, it needs this clumsy construct:
Apart from being ugly, it currently doesn't work reliably in cpu/foobar/Makefile.include, as the dependencies are not yet processed.
This PR allows used modules to append to some selected (through addition to MODULE_VARS) variables by setting e.g.,
CFLAGS.modulename += flag
Variables set like that will be collected after dependency resolution.
It is thus safe to e.g., set
CFLAGS.newlib += -DNEWLIB
even if newlib is unused. In that case, the statement will have no effect.A second PR adapts sys/Makefile.include to this scheme.
Testing procedure
Code should compile identically to before.
Issues/PRs references
none