adds a script to generate a clangd file for editor usage

This commit is contained in:
2025-05-29 10:50:23 -04:00
parent bdd20608fa
commit df4a508066
4 changed files with 21 additions and 8 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ bochslog.txt
*.iso
*.a
*.elf
.clangd

View File

@ -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

View File

@ -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

15
util/gen-clangd.sh Executable file
View File

@ -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