Skip to content

Commit c1c54b1

Browse files
Andrew Boieandrewboie
authored andcommitted
build: prevent subsystems.json from being gen
Actual files make terrible dependency targets in CMake. Wrap the generation of subsystems.json into a custom target to get around this. Fixes a problem where parse_syscalls.py was being called multiple times. Fixes: #23504 Signed-off-by: Andrew Boie <[email protected]>
1 parent cf720f9 commit c1c54b1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ set(SYSCALL_LIST_H_TARGET syscall_list_h_target)
5454
set(DRIVER_VALIDATION_H_TARGET driver_validation_h_target)
5555
set(KOBJ_TYPES_H_TARGET kobj_types_h_target)
5656
set(LINKER_SCRIPT_TARGET linker_script_target)
57-
57+
set(PARSE_SYSCALLS_TARGET parse_syscalls_target)
5858

5959
define_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT BRIEF_DOCS " " FULL_DOCS " ")
6060
set_property( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH}) # BFD format
@@ -598,6 +598,8 @@ add_custom_command(
598598
)
599599

600600
add_custom_target(${SYSCALL_LIST_H_TARGET} DEPENDS ${syscall_list_h})
601+
add_custom_target(${PARSE_SYSCALLS_TARGET}
602+
DEPENDS ${syscalls_json} ${subsys_json})
601603

602604
# 64-bit systems do not require special handling of 64-bit system call
603605
# parameters or return values, indicate this to the system call boilerplate
@@ -617,7 +619,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
617619
--syscall-list ${syscall_list_h}
618620
${SYSCALL_LONG_REGISTERS_ARG}
619621
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
620-
DEPENDS ${syscalls_json}
622+
DEPENDS ${PARSE_SYSCALLS_TARGET}
621623
)
622624

623625
# This is passed into all calls to the gen_kobject_list.py script.
@@ -634,7 +636,7 @@ add_custom_command(
634636
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
635637
DEPENDS
636638
${ZEPHYR_BASE}/scripts/gen_kobject_list.py
637-
${subsys_json}
639+
${PARSE_SYSCALLS_TARGET}
638640
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
639641
)
640642
add_custom_target(${DRIVER_VALIDATION_H_TARGET} DEPENDS ${DRV_VALIDATION})
@@ -954,7 +956,7 @@ if(CONFIG_USERSPACE)
954956
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
955957
DEPENDS
956958
${ZEPHYR_PREBUILT_EXECUTABLE}
957-
${subsys_json}
959+
${PARSE_SYSCALLS_TARGET}
958960
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
959961
)
960962
add_custom_target(obj_list DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OBJ_LIST})

cmake/kobj.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function(gen_kobj gen_dir_out)
2525
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
2626
DEPENDS
2727
$ENV{ZEPHYR_BASE}/scripts/gen_kobject_list.py
28-
${subsys_json}
28+
${PARSE_SYSCALLS_TARGET}
2929
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
3030
)
3131
add_custom_target(${KOBJ_TYPES_H_TARGET} DEPENDS ${KOBJ_TYPES} ${KOBJ_OTYPE})

0 commit comments

Comments
 (0)