diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..c97b399 --- /dev/null +++ b/.clang-format @@ -0,0 +1,24 @@ +BasedOnStyle: Google +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +ColumnLimit: 80 + +DerivePointerAlignment: false +PointerAlignment: Right +ReferenceAlignment: Right + +AlignConsecutiveMacros: Consecutive +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 + +IncludeBlocks: Regroup +IncludeCategories: + # Std headers + - Regex: '<[[:alnum:]_.]+>' + Priority: 2 + + # Other headers + - Regex: '.*' + Priority: 1 diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..7728b54 --- /dev/null +++ b/.clangd @@ -0,0 +1,6 @@ +CompileFlags: + CompilationDatabase: build + +Diagnostics: + UnusedIncludes: Strict + MissingIncludes: Strict diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3f415b2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[Makefile] +indent_style = tab +indent_size = 8 +tab_width = 8 diff --git a/Makefile b/Makefile index 1787090..b1149d0 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,9 @@ KERNEL_OBJ += $(patsubst kernel/%.asm, $(BUILD_DIR)/asm_%.o, $(KERNEL_ASM_SRC)) KLIBC_SRC = $(wildcard klibc/src/*.c) KLIBC_OBJ = $(patsubst klibc/src/%.c, $(BUILD_DIR)/klibc/%.o, $(KLIBC_SRC)) +.PHONY: all stage1 stage2 kernel compile-commands $(BUILD_DIR)/compile_commands.json run gdb clean clean-cross clean-all all: $(DISK_IMG) -.PHONY: stage1 stage2 kernel run gdb clean stage1: $(BUILD_DIR) $(AS) $(ASFLAGS) -o $(BUILD_DIR)/$@.o bootloader/$@.asm $(LD) -Ttext=0x7c00 -melf_i386 -o $(BUILD_DIR)/$@.elf $(BUILD_DIR)/$@.o @@ -57,6 +57,10 @@ $(BUILD_DIR): mkdir -p $@ mkdir -p $(BUILD_DIR)/klibc +compile-commands: $(BUILD_DIR)/compile_commands.json +$(BUILD_DIR)/compile_commands.json: $(BUILD_DIR) + bear --output $@ -- make -B + run: qemu-system-i386 -s -S $(DISK_IMG)