diff --git a/.gitignore b/.gitignore index 9f44571..d342f9c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ bochslog.txt *.iso *.a *.elf +.clangd diff --git a/Makefile b/Makefile index 4d268be..394fbd2 100644 --- a/Makefile +++ b/Makefile @@ -27,10 +27,13 @@ libk_objs = $(free_objs) # binaries = libk.a libc.a # Not ready for libc yet binaries = libk.a -.PHONY: clean all run install-headers install-libs +.PHONY: clean all run install-headers install-libs env all: kernel.elf +env: install-headers install-libs + util/./gen-clangd.sh + kernel.elf: install-headers install-libs $(c_kern_objects) $(asm_kern_objects) $(CC) $(CFLAGS) -T $(shell find . -name "link.ld") -o $@ $(c_kern_objects) $(asm_kern_objects) -nostdlib -lk -lgcc @@ -65,3 +68,4 @@ clean: -rm $(shell find . -name "*.o") -rm $(shell find . -name "*.d") -rm *.iso *.elf *.a com1.out bochslog.txt + -rm .clangd diff --git a/libc/include/stdio.h b/libc/include/stdio.h index b3be14e..94bf59a 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -5,16 +5,9 @@ #define EOF (-1) -#ifdef __cplusplus -extern "C" { -#endif - int printf(const char* __restrict, ...); int putchar(int); int puts(const char*); -#ifdef __cplusplus -} -#endif #endif diff --git a/util/gen-clangd.sh b/util/gen-clangd.sh new file mode 100755 index 0000000..f3113d1 --- /dev/null +++ b/util/gen-clangd.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# This must be built with `make env` in the root folder +# otherwises the paths will be incorrect + +echo "CompileFlags: + Add: + - \"--sysroot=$(pwd)/sysroot\" + - \"-ffreestanding\" + - \"-Wpedantic\" + - \"-Werror\" + - \"-Wall\" + - \"-Wextra\" +" > .clangd +