Many simple kconfig configurations are added to boards and brought in with the board name.
This makes a common import of these configs so one only requires adding a BOARD.config without having to alter the makefile.
Using EXTERNAL_MODULE_PATHS works fine when only using Kconfig for
configuratio, but when using it for dependencies this value is not
set since it depends on Kconfig. Instead use EXTERNAL_MODULE_DIRS
and filter matching on Kconfig files.
This introduces KCONFIG_BOARD_CONFIG and KCONFIG_CPU_CONFIG variable for
boards and CPUs (including common directories) to add default
configuration files to be merged. The current approach, as it uses
Makefile.features, would include boards first, not allowing them to
override CPU configurations.
As the packages need to be downloaded before they can be included in menuconfig it becomes a bit pointless.
This also messes around with make info-packages, adding unwanted output
Previously, external modules had to be individually added to both
EXTERNAL_MODULE_DIRS and USEMODULE. If those where not in sync, this
resulted in build errors.
With this commit, search folders for external modules are added to
EXTERNAL_MODULE_DIRS instead. So lets say the file system structure is
like this
```
└── /path/to/external/modules
├── mod_a
│ ├── Makefile
│ ├── Makefile.dep
│ ├── Makefile.include
│ ├── foo.c
│ └── include
│ └── external_module.h
└── mod_b
├── Makefile
└── bar.c
```
One now adds `/path/to/external/modules` to EXTERNAL_MODULES and only
with `USEMODULE += mod_a` the corresponding module, dependencies and
include settings are actually used. Hence, it is possible to configure
`EXTERNAL_MODULE_DIRS` from `~/.profile` or `~/.bashrc` once and never
needs to worry about them again.
This adds a check in the build process to verify that no ERROR_ Kconfig
symbols are set. These symbols indicate invalid conditions in the
Kconfig configuration.
Kconfig.dep depends on FORCE, so it is always generated when compiling
with Kconfig under normal conditions. Whan TEST_KCONFIG=1 is set, this
file is no longer a dependency for out.config. So when cleaning the
'bin' directory, out.config has no direct dependencies that force its
rebuilding (the generated directory is order only). This causes the file
not to be produced when calling `TEST_KCONFIG=1 make clean all`.
This PR changes the dependency on the 'generated' directory to a direct
dependency when `CLEAN` is set and leaves it as order-only when not.
This allows to generate out.config only when needed by not depending on
FORCE.
This changes the prefixes of the symbols generated from USEMODULE and
USEPKG variables. The changes are as follow:
KCONFIG_MODULE_ => KCONFIG_USEMODULE_
KCONFIG_PKG_ => KCONFIG_USEPKG_
MODULE_ => USEMODULE_
PKG_ => USEPKG_
This switch allows to test the module dependency modelling during the
Kconfig migration. When set, it will use the symbols prefixed with
CONFIG_MOD_ defined by Kconfig as the list of modules to compile.
Instead of the merged.config file, menuconfig operates directly on
out.config, which also is the destination of the merge of multiple
configuration sources.
Also, this introduces the autoconf.h.d file to track the Kconfig
dependencies and re-trigger the build of the header when any of the
Kconfig files change.
This allows to include KCONFIG_OUT_CONFIG file in Makefile
unconditionally, which means that `make clean all` is allowed when using
Kconfig.
For this, the recipe for `clean` is guarded with `MAKE_RESTARTS` so
the BINDIR folder is not removed once Make restarts scanning the files.
'merged.config' may not always be present (e.g. when no files to merge
are present). In order to always have an up-to-date configuration file
'out.config' will be generated mirroring the content of 'autoconf.h'.
This is the file that the build system will include to read the current
configuration symbols.
In Windows setups using MSYS environment variables which start with a
slash get the 'root path' added. This adds a second slash to the content
of KCONFIG_AUTOHEADER_HEADER, so the first one is escaped when building
on those platforms.
This adds a check to decide if Kconfig should run on a build. It will
run if any of the following conditions is true:
- A file with '.config' extension is present in the application folder
- A 'Kconfig' file is present in the application folder
- A previous configuration file is present (e.g. from a previous call to
menuconfig)
- menuconfig is being called
This assumes that Kconfig will not generate any default configurations
just from the Kconfig files outside the application folder (i.e. module
configuration via Kconfig is disabled by default). Should this change,
the check would not longer be valid, and Kconfig would have to run on
every build.
- The autoconf.h header file, generated with the current Kconfig
configurations, is added as a build dependency.
- autoconf.h depends on the proper tool (genconfig) and a Kconfig.dep
which contains the dependencies for the given application and board,
this is generated from $(USEMODULE).
- The menuconfig target is added, to allow the configuration of modules
using the Kconfig system.