* 更改编译器的Include路径,使得include时不需要加`<libc/src/include/>`前缀 * 修改include路径 Co-authored-by: longjin <[email protected]>
@@ -1,15 +1,16 @@
{
"configurations": [
- "name": "Linux",
+ "name": "DragonOS",
"includePath": [
- "${workspaceFolder}/**"
+ "${workspaceFolder}/**",
+ "${workspaceFolder}/user/libs/libc/src/include"
],
"defines": [
"__x86_64__",
"DEBUG"
- "compilerPath": "/usr/bin/gcc",
+ "compilerPath": "~/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin/x86_64-elf-gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
@@ -169,8 +169,9 @@
"stdint-gcc.h": "c",
"acpi.h": "c",
"assert.h": "c",
- "sys_version.h": "c"
-},
+ "sys_version.h": "c",
+ "cmd.h": "c"
+ },
"C_Cpp.errorSquiggles": "Enabled",
"esbonio.sphinx.confDir": "",
"rust-analyzer.cargo.target": "x86_64-unknown-none",
@@ -47,12 +47,14 @@ all: kernel user
.PHONY: kernel
kernel:
mkdir -p bin/kernel/
+ @if [ -z $$DragonOS_GCC ]; then echo "\033[31m [错误]尚未安装DragonOS交叉编译器, 请使用tools文件夹下的build_gcc_toolchain.sh脚本安装 \033[0m"; exit 1; fi
$(MAKE) -C ./kernel all || (sh -c "echo 内核编译失败" && exit 1)
.PHONY: user
user:
mkdir -p bin/user/
mkdir -p bin/tmp/user
$(MAKE) -C ./user all || (sh -c "echo 用户程序编译失败" && exit 1)
.PHONY: clean
@@ -9,7 +9,7 @@ GARBAGE := $(foreach DIR,$(DIRS),$(addprefix $(DIR)/,$(GARBAGE_PATTERNS)))
tmp_output_dir=$(ROOT_PATH)/bin/tmp/user
output_dir=$(ROOT_PATH)/bin/user
-CFLAGS := $(GLOBAL_CFLAGS) -I $(shell pwd)/libs
+CFLAGS := $(GLOBAL_CFLAGS) -I $(shell pwd)/libs -I $(shell pwd)/libs/libc/src/include
current_CFLAGS := $(CFLAGS)
ECHO:
@@ -22,7 +22,6 @@ $(user_sub_dirs): ECHO sys_api_lib
app: $(user_sub_dirs)
all: app
- @if [ -z $$DragonOS_GCC ]; then echo "\033[31m [错误]尚未安装DragonOS交叉编译器, 请使用tools文件夹下的build_gcc_toolchain.sh脚本安装 \033[0m"; exit 1; fi
$(shell if [ ! -e $(tmp_output_dir) ];then mkdir -p $(tmp_output_dir); fi)
$(shell if [ ! -e $(output_dir) ];then mkdir -p $(output_dir); fi)
@@ -1,9 +1,9 @@
#include "sys_version.h" // 这是系统的版本头文件,在编译过程中自动生成
-#include <libc/src/math.h>
-#include <libc/src/stdio.h>
-#include <libc/src/stdlib.h>
-#include <libc/src/time.h>
-#include <libc/src/unistd.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <unistd.h>
void print_ascii_logo()
@@ -1,17 +1,17 @@
#include "cmd.h"
#include "cmd_help.h"
#include "cmd_test.h"
-#include <libc/src/dirent.h>
-#include <libc/src/errno.h>
-#include <libc/src/fcntl.h>
-#include <libc/src/include/signal.h>
-#include <libc/src/stddef.h>
-#include <libc/src/string.h>
-#include <libc/src/sys/stat.h>
-#include <libc/src/sys/wait.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
#include <libsystem/syscall.h>
// 当前工作目录(在main_loop中初始化)
@@ -1,6 +1,7 @@
+
struct help_table_item_t
void (*func)();
@@ -1,8 +1,8 @@
int shell_pipe_test(int argc, char **argv)
@@ -1,13 +1,13 @@
#include <libKeyboard/keyboard.h>
-#include <libc/src/printf.h>
+#include <printf.h>
#define pause_cpu() asm volatile("pause\n\t");
#define MEM_HISTORY 1024
@@ -17,13 +17,12 @@
*
*/
-
bool handle_ok = false;
@@ -1,5 +1,6 @@
#include "keyboard.h"
// 功能键标志变量
static bool shift_l = 0, shift_r = 0, ctrl_l = 0, ctrl_r = 0, alt_l = 0, alt_r = 0;
static bool gui_l = 0, gui_r = 0, apps = 0, insert = 0, home = 0, pgup = 0, del = 0, end = 0, pgdn = 0, arrow_u = 0, arrow_l = 0, arrow_d = 0, arrow_r = 0;
@@ -1,6 +1,6 @@
all:
- $(MAKE) -C src all
+ $(MAKE) CFLAGS="$(CFLAGS)" -C src all
clean:
rm -f Cargo.lock
@@ -1,4 +1,4 @@
-#include <libc/src/ctype.h>
+#include <ctype.h>
int isprint(int c)
@@ -1,10 +1,10 @@
-#include "dirent.h"
-#include "unistd.h"
-#include "stdio.h"
-#include "fcntl.h"
-#include "stddef.h"
-#include "stdlib.h"
-#include "string.h"
/**
@@ -1,2 +1,2 @@
-#include "errno.h"
int errno = 0;
#pragma once
-#include <libc/src/sys/types.h>
+#include <sys/types.h>
-#include <libc/src/__libc__.h>
+#include <__libc__.h>
int isalnum(int c);
@@ -1,5 +1,5 @@
// ===== 描述long double 的数据比特结构
#if __LDBL_MANT_DIG__ == 53 && __LDBL_MAX_EXP__ == 1024
double fabs(double x);
float fabsf(float x);
#define SIGHUP 1
#define SIGINT 2
#ifdef __cplusplus
#define NULL 0
#include <stdarg.h>
// 字体颜色的宏定义
* @brief 获取一块堆内存
void *memset(void *dst, unsigned char C, uint64_t size);
* @brief 系统内存信息结构体(单位:字节)
-#include <libc/src/include/stdint.h>
+#include <stdint.h>
#include <stdbool.h>
typedef unsigned char u_char;
-#include "types.h"
* @brief 等待所有子进程退出
// 操作系统定义时间以ns为单位
#define CLOCKS_PER_SEC 1000000
* @brief 关闭文件接口
#define PAGE_4K_SHIFT 12
#define PAGE_2M_SHIFT 21
-#include "libm.h"
+#include <libm.h>
double fabs(double x)
union
int64_t pow(int64_t x, int y)
#if __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1
#define EPS __DBL_EPSILON__
-#include "printf.h"
static char *write_num(char *str, uint64_t num, int base, int field_width, int precision, int flags);
#pragma GCC push_options
int abs(int i)
size_t strlen(const char *s)
-#include "stat.h"
int mkdir(const char *path, mode_t mode)
-#include "wait.h"
extern int main(int, char **);
-#include "time.h"
#include "syscall.h"
long syscall_invoke(uint64_t syscall_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7)
uint64_t __err_code;
// 系统调用号
#define SYS_NOT_EXISTS 0