makefiles/kconfig: Include configuration symbols to build system#12913
Merged
cgundogan merged 1 commit intoRIOT-OS:masterfrom Dec 19, 2019
Merged
makefiles/kconfig: Include configuration symbols to build system#12913cgundogan merged 1 commit intoRIOT-OS:masterfrom
cgundogan merged 1 commit intoRIOT-OS:masterfrom
Conversation
cgundogan
reviewed
Dec 14, 2019
This was referenced Dec 16, 2019
If the generated configuration file is present include it. That way one can check if certain symbols are being configured using Kconfig.
21c76a0 to
707ad8d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Besides the
autoconf.hheader file, which contains the configurationssynbols in the form of C macros, Kconfig generates a
.configfile. This file has Makefile syntax and contains the same configuration symbols in the form of variables.This is useful to check if a certain option is being set. E.g. to decide if a CFLAG should be used to configure something:
Note on how this is working
When
make allis called, make starts reading all Makefiles. At some point it finds the-includedirective for themerged.configfile. If the file is there (i.e. it's not a clean build) it will jump to the file and read, if not, it will continue readingkconfig.mk. Once make has read all the files it will try to remake all the included files. For that, it will look for implicit and explicit rules to remake the files. In the particular case ofmerged.configit will find this:RIOT/makefiles/kconfig.mk
Lines 72 to 83 in 2027efa
If the file is updated (either because it was not there or because of a change on a source file) make will start from scratch reading all the (now updated) makefiles. This way, the user can check for Kconfig symbols in the application's Makefile (after including
Makefile.include).The problem with
cleanIn the case
make clean allis calledmerged.configis not included.Why? The reason is that it depends on the
generatedfolder being created, which in turn depends on$(CLEAN)(which is actuallycleanif it was called). So if we always included the file, make would try to remake it, it would runclean, and create it again. The it would start over and try to remake it, it would runcleanagain, updating the file and re-triggering this mechanism forever.Not including the file on
cleanhas the side effect of not being able to include Kconfig symbols on build, when runningmake clean all. So far, if users want to use Kconfig they will have to callmake clean && make all. Any proposal to solve this is appreciated :-)Testing procedure
You can add these messages to the
tests/kconfigapplication:app.configsets the MSG 2 as active by default.make clean && make all, you should see that first MSG 2 is not active and then make starts over with MSG 2 is active.make allagain, you should only see MSG 2 is active once.make menuconfigand disable the message. You should see MSG 2 is not active (once).make clean all, as the file is not included you will see MSG 2 is not active.Issues/PRs references
None