@@ -24,9 +24,11 @@ if(NOT HWMv2)
2424endif ()
2525
2626# Internal helper function for creation of Kconfig files.
27- function (kconfig_gen bin_dir file dirs)
28- file (MAKE_DIRECTORY "${bin_dir} " )
29- set (kconfig_file ${bin_dir} /${file} )
27+ function (kconfig_gen bin_dir file dirs comment )
28+ set (kconfig_header "# Load ${comment} descriptions.\n " )
29+ set (kconfig_file ${KCONFIG_BINARY_DIR} /${bin_dir} /${file} )
30+ file (WRITE ${kconfig_file} "${kconfig_header} " )
31+
3032 foreach (dir ${dirs} )
3133 cmake_path(CONVERT "${dir} " TO_CMAKE_PATH_LIST dir)
3234 file (APPEND ${kconfig_file} "osource \" ${dir} /${file} \"\n " )
@@ -92,28 +94,12 @@ while(TRUE)
9294endwhile ()
9395list (REMOVE_DUPLICATES kconfig_soc_source_dir)
9496
95- # Support multiple ARCH_ROOT and SOC_ROOT
96- set (arch_kconfig_file Kconfig)
97- set (soc_defconfig_file Kconfig.defconfig)
98- set (soc_zephyr_file Kconfig)
99- set (soc_kconfig_file Kconfig.soc)
100- set (soc_sysbuild_file Kconfig.sysbuild)
101- set (arch_kconfig_header "# Load arch Kconfig descriptions.\n " )
102- set (defconfig_header "# Load Zephyr SoC Kconfig defconfig.\n " )
103- set (soc_zephyr_header "# Load Zephyr SoC Kconfig descriptions.\n " )
104- set (soc_kconfig_header "# Load SoC Kconfig descriptions.\n " )
105- set (soc_sysbuild_header "# Load SoC sysbuild Kconfig descriptions.\n " )
106- file (WRITE ${KCONFIG_BINARY_DIR} /arch/${arch_kconfig_file} "${arch_kconfig_header} " )
107- file (WRITE ${KCONFIG_BINARY_DIR} /soc/${soc_defconfig_file} "${defconfig_header} " )
108- file (WRITE ${KCONFIG_BINARY_DIR} /soc/${soc_zephyr_file} "${soc_zephyr_header} " )
109- file (WRITE ${KCONFIG_BINARY_DIR} /soc/${soc_kconfig_file} "${soc_kconfig_header} " )
110- file (WRITE ${KCONFIG_BINARY_DIR} /soc/${soc_sysbuild_file} "${soc_sysbuild_header} " )
111-
112- kconfig_gen("${KCONFIG_BINARY_DIR} /arch" "${arch_kconfig_file} " "${kconfig_arch_source_dir} " )
113- kconfig_gen("${KCONFIG_BINARY_DIR} /soc" "${soc_defconfig_file} " "${kconfig_soc_source_dir} " )
114- kconfig_gen("${KCONFIG_BINARY_DIR} /soc" "${soc_zephyr_file} " "${kconfig_soc_source_dir} " )
115- kconfig_gen("${KCONFIG_BINARY_DIR} /soc" "${soc_kconfig_file} " "${kconfig_soc_source_dir} " )
116- kconfig_gen("${KCONFIG_BINARY_DIR} /soc" "${soc_sysbuild_file} " "${kconfig_soc_source_dir} " )
97+ # Support multiple ARCH_ROOT, SOC_ROOT and BOARD_ROOT
98+ kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir} " "Zephyr Arch Kconfig" )
99+ kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir} " "Zephyr SoC defconfig" )
100+ kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir} " "Zephyr SoC Kconfig" )
101+ kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir} " "SoC Kconfig" )
102+ kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir} " "Sysbuild SoC Kconfig" )
117103
118104# Clear variables created by cmake_parse_arguments
119105unset (SOC_V2_NAME)
0 commit comments