1# SPDX-License-Identifier: Apache-2.0 2 3# As minimal libc will be built as a zephyr_library, clear c_library to 4# prevent accidentally requiring or linking against another libc implementation. 5set_property(TARGET linker PROPERTY c_library "") 6 7zephyr_system_include_directories(include) 8 9zephyr_library() 10 11set(GEN_DIR ${ZEPHYR_BINARY_DIR}/include/generated) 12set(STRERROR_TABLE_H ${GEN_DIR}/libc/minimal/strerror_table.h) 13 14zephyr_library_compile_options($<TARGET_PROPERTY:compiler,no_builtin>) 15zephyr_library_compile_options($<TARGET_PROPERTY:compiler,prohibit_lto>) 16 17zephyr_library_sources( 18 source/stdlib/atoi.c 19 source/stdlib/strtol.c 20 source/stdlib/strtoul.c 21 source/stdlib/strtoll.c 22 source/stdlib/strtoull.c 23 source/stdlib/bsearch.c 24 source/stdlib/exit.c 25 source/stdlib/qsort.c 26 source/string/strerror.c 27 source/string/strncasecmp.c 28 source/string/strstr.c 29 source/string/string.c 30 source/string/strspn.c 31 source/stdout/stdout_console.c 32 source/stdout/sprintf.c 33 source/stdout/fprintf.c 34 source/math/sqrtf.c 35 source/math/sqrt.c 36 ${STRERROR_TABLE_H} 37) 38 39if(CONFIG_MINIMAL_LIBC_TIME) 40 zephyr_library_sources(source/time/gmtime.c) 41endif() 42 43zephyr_library_sources_ifdef(CONFIG_MINIMAL_LIBC_RAND source/stdlib/rand.c) 44 45add_custom_command( 46 OUTPUT ${STRERROR_TABLE_H} 47 COMMAND 48 ${PYTHON_EXECUTABLE} 49 ${ZEPHYR_BASE}/scripts/build/gen_strerror_table.py 50 -i include/errno.h 51 -o ${STRERROR_TABLE_H} 52 DEPENDS include/errno.h 53 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 54) 55