瀏覽代碼

修改common下的sconscript脚本文件,增加unistd.c排除条件

mysterywolf 4 年之前
父節點
當前提交
f021cb982a
共有 2 個文件被更改,包括 5 次插入5 次删除
  1. 3 0
      components/libc/compilers/common/SConscript
  2. 2 5
      components/libc/compilers/common/unistd.c

+ 3 - 0
components/libc/compilers/common/SConscript

@@ -13,6 +13,9 @@ else:
         if GetDepend('RT_LIBC_USING_TIME'):
         if GetDepend('RT_LIBC_USING_TIME'):
                 src += ['time.c']
                 src += ['time.c']
 
 
+if GetDepend('RT_USING_POSIX') == False:
+        SrcRemove(src, ['unistd.c'])
+
 group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH)
 group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH)
 
 
 Return('group')
 Return('group')

+ 2 - 5
components/libc/compilers/common/unistd.c

@@ -8,12 +8,11 @@
  * 2020-09-01     Meco Man     First Version
  * 2020-09-01     Meco Man     First Version
  */
  */
 
 
-#include <termios.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-#ifdef RT_USING_POSIX
-
 #ifdef RT_USING_POSIX_TERMIOS
 #ifdef RT_USING_POSIX_TERMIOS
+#include <termios.h>
+
 int isatty(int fd)
 int isatty(int fd)
 {
 {
     struct termios ts;
     struct termios ts;
@@ -25,5 +24,3 @@ char *ttyname(int fd)
 {
 {
     return "/dev/tty0"; /*TODO: need to add more specific*/
     return "/dev/tty0"; /*TODO: need to add more specific*/
 }
 }
-
-#endif