diff --git a/arch/CMakeLists.txt b/arch/CMakeLists.txt index 1ffdc3b2f45..3ebb9ccebff 100644 --- a/arch/CMakeLists.txt +++ b/arch/CMakeLists.txt @@ -2,5 +2,10 @@ add_definitions(-D__ZEPHYR_SUPERVISOR__) +include_directories( + ${ZEPHYR_BASE}/kernel/include + ${ZEPHYR_BASE}/arch/${ARCH}/include + ) + add_subdirectory(common) add_subdirectory(${ARCH_DIR}/${ARCH} arch/${ARCH}) diff --git a/arch/arc/core/CMakeLists.txt b/arch/arc/core/CMakeLists.txt index f3f4c721e79..8c86b8e550c 100644 --- a/arch/arc/core/CMakeLists.txt +++ b/arch/arc/core/CMakeLists.txt @@ -28,10 +28,5 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S) zephyr_library_sources_ifdef(CONFIG_ARC_CONNECT arc_connect.c) zephyr_library_sources_ifdef(CONFIG_SMP arc_smp.c) -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arc/include - ) - add_subdirectory_ifdef(CONFIG_ARC_CORE_MPU mpu) add_subdirectory_ifdef(CONFIG_ARC_SECURE_FIRMWARE secureshield) diff --git a/arch/arc/core/mpu/CMakeLists.txt b/arch/arc/core/mpu/CMakeLists.txt index 880c7d383a0..a81e4ebdb2c 100644 --- a/arch/arc/core/mpu/CMakeLists.txt +++ b/arch/arc/core/mpu/CMakeLists.txt @@ -4,8 +4,3 @@ zephyr_library() zephyr_library_sources_if_kconfig(arc_core_mpu.c) zephyr_library_sources_if_kconfig(arc_mpu.c) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arc/include - ) diff --git a/arch/arc/core/secureshield/CMakeLists.txt b/arch/arc/core/secureshield/CMakeLists.txt index 8b3cb345581..9145e63e946 100644 --- a/arch/arc/core/secureshield/CMakeLists.txt +++ b/arch/arc/core/secureshield/CMakeLists.txt @@ -10,8 +10,3 @@ zephyr_library_sources( arc_secure.S secure_sys_services.c ) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arc/include - ) diff --git a/arch/arm/core/CMakeLists.txt b/arch/arm/core/CMakeLists.txt index 9428870be58..cb090dace32 100644 --- a/arch/arm/core/CMakeLists.txt +++ b/arch/arm/core/CMakeLists.txt @@ -20,11 +20,6 @@ zephyr_library_sources( prep_c.c ) -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arm/include -) - zephyr_library_sources_ifdef(CONFIG_GEN_SW_ISR_TABLE isr_wrapper.S) zephyr_library_sources_ifdef(CONFIG_CPLUSPLUS __aeabi_atexit.c) zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c) diff --git a/arch/arm/core/cortex_m/CMakeLists.txt b/arch/arm/core/cortex_m/CMakeLists.txt index 517143d3a2b..556db5930b1 100644 --- a/arch/arm/core/cortex_m/CMakeLists.txt +++ b/arch/arm/core/cortex_m/CMakeLists.txt @@ -15,8 +15,3 @@ zephyr_linker_sources_ifdef(CONFIG_SW_VECTOR_RELAY RAM_SECTIONS vt_pointer_section.ld ) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arm/include -) diff --git a/arch/arm/core/cortex_m/cmse/CMakeLists.txt b/arch/arm/core/cortex_m/cmse/CMakeLists.txt index 5d779e8175f..6e8ca7e3ac3 100644 --- a/arch/arm/core/cortex_m/cmse/CMakeLists.txt +++ b/arch/arm/core/cortex_m/cmse/CMakeLists.txt @@ -1,3 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_sources(arm_core_cmse.c) +zephyr_library() + +zephyr_library_sources(arm_core_cmse.c) diff --git a/arch/arm/core/cortex_m/tz/CMakeLists.txt b/arch/arm/core/cortex_m/tz/CMakeLists.txt index 04c398adb8a..a525844c8b9 100644 --- a/arch/arm/core/cortex_m/tz/CMakeLists.txt +++ b/arch/arm/core/cortex_m/tz/CMakeLists.txt @@ -32,4 +32,8 @@ zephyr_link_libraries_ifdef(CONFIG_ARM_FIRMWARE_USES_SECURE_ENTRY_FUNCS ${CMAKE_BINARY_DIR}/${CONFIG_ARM_ENTRY_VENEERS_LIB_NAME} ) -zephyr_sources_ifdef(CONFIG_ARM_SECURE_FIRMWARE arm_core_tz.c) +if(CONFIG_ARM_SECURE_FIRMWARE) + zephyr_library() + + zephyr_library_sources(arm_core_tz.c) +endif() diff --git a/arch/arm/core/cortex_r/CMakeLists.txt b/arch/arm/core/cortex_r/CMakeLists.txt index 1b684470f87..a1154a3efb9 100644 --- a/arch/arm/core/cortex_r/CMakeLists.txt +++ b/arch/arm/core/cortex_r/CMakeLists.txt @@ -9,8 +9,3 @@ zephyr_library_sources( reboot.c stacks.c ) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/arm/include -) diff --git a/arch/common/CMakeLists.txt b/arch/common/CMakeLists.txt index 5b5d42d98c9..38b71da460a 100644 --- a/arch/common/CMakeLists.txt +++ b/arch/common/CMakeLists.txt @@ -1,20 +1,24 @@ # SPDX-License-Identifier: Apache-2.0 +if(CONFIG_GEN_ISR_TABLES OR CONFIG_EXECUTION_BENCHMARKING) + zephyr_library() + + zephyr_library_sources_ifdef( + CONFIG_GEN_ISR_TABLES + isr_tables.c + sw_isr_common.c + ) + + zephyr_library_sources_ifdef( + CONFIG_EXECUTION_BENCHMARKING + timing_info_bench.c + ) +endif() + # Put functions and data in their own binary sections so that ld can # garbage collect them zephyr_cc_option(-ffunction-sections -fdata-sections) -zephyr_sources_ifdef( - CONFIG_GEN_ISR_TABLES - isr_tables.c - sw_isr_common.c - ) - -zephyr_sources_ifdef( - CONFIG_EXECUTION_BENCHMARKING - timing_info_bench.c - ) - zephyr_linker_sources_ifdef(CONFIG_GEN_ISR_TABLES SECTIONS isr_tables.ld @@ -29,8 +33,3 @@ zephyr_linker_sources_ifdef(CONFIG_NOCACHE_MEMORY RAM_SECTIONS nocache.ld ) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/${ARCH}/include -) diff --git a/arch/nios2/core/CMakeLists.txt b/arch/nios2/core/CMakeLists.txt index 925e2f64509..cfda508543e 100644 --- a/arch/nios2/core/CMakeLists.txt +++ b/arch/nios2/core/CMakeLists.txt @@ -16,8 +16,3 @@ zephyr_library_sources( ) zephyr_library_sources_if_kconfig(irq_offload.c) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/nios2/include - ) diff --git a/arch/riscv/core/CMakeLists.txt b/arch/riscv/core/CMakeLists.txt index d7c059adb27..653f2b4cf8a 100644 --- a/arch/riscv/core/CMakeLists.txt +++ b/arch/riscv/core/CMakeLists.txt @@ -14,8 +14,3 @@ zephyr_library_sources( ) zephyr_library_sources_if_kconfig(irq_offload.c) - -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/riscv/include -) diff --git a/arch/x86/core/CMakeLists.txt b/arch/x86/core/CMakeLists.txt index 082ae37f5eb..36b6bcbc433 100644 --- a/arch/x86/core/CMakeLists.txt +++ b/arch/x86/core/CMakeLists.txt @@ -19,11 +19,6 @@ zephyr_library_sources_if_kconfig(x86_mmu.c) zephyr_library_sources_ifdef(CONFIG_X86_VERY_EARLY_CONSOLE early_serial.c) -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/x86/include -) - if(CONFIG_X86_64) include(intel64.cmake) else() diff --git a/arch/xtensa/core/CMakeLists.txt b/arch/xtensa/core/CMakeLists.txt index b19b30c9f9b..19a63ff83e9 100644 --- a/arch/xtensa/core/CMakeLists.txt +++ b/arch/xtensa/core/CMakeLists.txt @@ -16,9 +16,4 @@ zephyr_library_sources_ifndef(CONFIG_ATOMIC_OPERATIONS_C atomic.S) zephyr_library_sources_ifdef(CONFIG_XTENSA_USE_CORE_CRT1 crt1.S) zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD irq_offload.c) -zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/xtensa/include - ) - add_subdirectory(startup) diff --git a/arch/xtensa/core/startup/CMakeLists.txt b/arch/xtensa/core/startup/CMakeLists.txt index d6595f5cb33..1c21781ca72 100644 --- a/arch/xtensa/core/startup/CMakeLists.txt +++ b/arch/xtensa/core/startup/CMakeLists.txt @@ -14,9 +14,4 @@ if(CONFIG_XTENSA_RESET_VECTOR) memerror-vector.S memctl_default.S ) - - zephyr_library_include_directories( - ${ZEPHYR_BASE}/kernel/include - ${ZEPHYR_BASE}/arch/xtensa/include - ) endif()