cmake: trigger olddefconfig on kconfig changes

When there are changes made to Kconfig files it's better
to run olddefconfig automatically to prevent undesired behaviour,
like for example depending on added config that has some default value
that is not present because developer didn't run olddefconfig
after pulling changes.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
Janusz Jankowski 2019-11-06 12:10:25 +01:00
parent 98449205fb
commit 5211799133
1 changed files with 20 additions and 0 deletions

View File

@ -31,6 +31,26 @@ add_custom_target(
USES_TERMINAL
)
file(GLOB_RECURSE KCONFIG_FILES "${SOF_ROOT_SOURCE_DIRECTORY}/Kconfig")
if(EXISTS ${DOT_CONFIG_PATH})
# Update with olddefconfig only if config was previously generated
add_custom_command(
OUTPUT ${DOT_CONFIG_PATH}
COMMAND ${CMAKE_COMMAND} -E env
srctree=${PROJECT_SOURCE_DIR}
CC_VERSION_TEXT=${CC_VERSION_TEXT}
ARCH=${ARCH}
${PYTHON3} ${PROJECT_SOURCE_DIR}/scripts/kconfig/olddefconfig.py
${PROJECT_SOURCE_DIR}/Kconfig
DEPENDS ${KCONFIG_FILES}
WORKING_DIRECTORY ${GENERATED_DIRECTORY}
COMMENT "Regenerating .config with olddefconfig"
VERBATIM
USES_TERMINAL
)
endif()
add_custom_command(
OUTPUT ${CONFIG_H_PATH}
COMMAND ${CMAKE_COMMAND} -E env