diff --git a/libc/src/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt --- a/libc/src/stdio/CMakeLists.txt +++ b/libc/src/stdio/CMakeLists.txt @@ -8,16 +8,17 @@ DEPENDS .${LIBC_TARGET_OS}.${name} ) - elseif(TARGET libc.src.stdio.generic_${name}) + elseif(TARGET libc.src.stdio.generic.${name}) add_entrypoint_object( ${name} ALIAS DEPENDS - .generic_${name} + .generic.${name} ) endif() endfunction(add_stdio_entrypoint_object) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/generic) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) endif() @@ -341,33 +342,6 @@ libc.src.__support.File.platform_file ) -add_entrypoint_object( - generic_fputs - SRCS - fputs.cpp - HDRS - fputs.h - DEPENDS - libc.src.errno.errno - libc.include.stdio - libc.src.__support.File.file - libc.src.__support.File.platform_file -) - - -add_entrypoint_object( - generic_puts - SRCS - puts.cpp - HDRS - puts.h - DEPENDS - libc.src.errno.errno - libc.include.stdio - libc.src.__support.File.file - libc.src.__support.File.platform_file -) - add_entrypoint_object( fseek SRCS @@ -405,42 +379,6 @@ libc.src.__support.File.file ) -add_entrypoint_object( - generic_stdin - SRCS - stdin.cpp - HDRS - stdin.h - DEPENDS - libc.include.stdio - libc.src.__support.File.file - libc.src.__support.File.platform_file -) - -add_entrypoint_object( - generic_stdout - SRCS - stdout.cpp - HDRS - stdout.h - DEPENDS - libc.include.stdio - libc.src.__support.File.file - libc.src.__support.File.platform_file -) - -add_entrypoint_object( - generic_stderr - SRCS - stderr.cpp - HDRS - stderr.h - DEPENDS - libc.include.stdio - libc.src.__support.File.file - libc.src.__support.File.platform_file -) - add_entrypoint_object( setbuf SRCS diff --git a/libc/src/stdio/generic/CMakeLists.txt b/libc/src/stdio/generic/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/libc/src/stdio/generic/CMakeLists.txt @@ -0,0 +1,66 @@ +if(LIBC_TARGET_ARCHITECTURE_IS_GPU) + # The GPU build cannot use any generic implementations. + return() +endif() + +add_entrypoint_object( + fputs + SRCS + fputs.cpp + HDRS + ../fputs.h + DEPENDS + libc.src.errno.errno + libc.include.stdio + libc.src.__support.File.file + libc.src.__support.File.platform_file +) + +add_entrypoint_object( + puts + SRCS + puts.cpp + HDRS + ../puts.h + DEPENDS + libc.src.errno.errno + libc.include.stdio + libc.src.__support.File.file + libc.src.__support.File.platform_file +) + +add_entrypoint_object( + stdin + SRCS + stdin.cpp + HDRS + ../stdin.h + DEPENDS + libc.include.stdio + libc.src.__support.File.file + libc.src.__support.File.platform_file +) + +add_entrypoint_object( + stdout + SRCS + stdout.cpp + HDRS + ../stdout.h + DEPENDS + libc.include.stdio + libc.src.__support.File.file + libc.src.__support.File.platform_file +) + +add_entrypoint_object( + stderr + SRCS + stderr.cpp + HDRS + ../stderr.h + DEPENDS + libc.include.stdio + libc.src.__support.File.file + libc.src.__support.File.platform_file +) diff --git a/libc/src/stdio/fputs.cpp b/libc/src/stdio/generic/fputs.cpp rename from libc/src/stdio/fputs.cpp rename to libc/src/stdio/generic/fputs.cpp diff --git a/libc/src/stdio/puts.cpp b/libc/src/stdio/generic/puts.cpp rename from libc/src/stdio/puts.cpp rename to libc/src/stdio/generic/puts.cpp diff --git a/libc/src/stdio/stderr.cpp b/libc/src/stdio/generic/stderr.cpp rename from libc/src/stdio/stderr.cpp rename to libc/src/stdio/generic/stderr.cpp diff --git a/libc/src/stdio/stdin.cpp b/libc/src/stdio/generic/stdin.cpp rename from libc/src/stdio/stdin.cpp rename to libc/src/stdio/generic/stdin.cpp diff --git a/libc/src/stdio/stdout.cpp b/libc/src/stdio/generic/stdout.cpp rename from libc/src/stdio/stdout.cpp rename to libc/src/stdio/generic/stdout.cpp