Compare commits

..

3 commits

Author SHA1 Message Date
Imbus
502bd93e07 Note about clang-format and find 2025-09-02 04:03:25 +02:00
Imbus
bd29521b09 Use makefile includes 2025-09-02 04:03:19 +02:00
Imbus
056ff77c55 Include.mk in kern and kern/libkern 2025-09-02 04:03:07 +02:00
4 changed files with 20 additions and 13 deletions

View file

@ -51,19 +51,11 @@ all: kern/kernel.elf
quickstart: quickstart:
make get_toolchain && bear -- make -j$(nproc) && make qemu make get_toolchain && bear -- make -j$(nproc) && make qemu
KERNEL_OBJ := \ SUBDIRS := kern
kern/entry.o \
kern/start.o \ include $(patsubst %, %/include.mk, $(SUBDIRS))
kern/kalloc.o \
kern/libkern/string.o \ KERNEL_OBJ := $(KERN_OBJ)
kern/libkern/proc.o \
kern/libkern/uart.o \
kern/libkern/panic.o \
kern/libkern/memory.o \
kern/libkern/spinlock.o \
kern/libkern/mini-printf.o \
kern/libkern/stdio.o \
kern/libkern/badrand.o
kern/kernel.elf: $(KERNEL_OBJ) kern/kernel.elf: $(KERNEL_OBJ)
@echo LD $@ @echo LD $@

View file

@ -26,6 +26,7 @@ On a linux machine, make sure that you have `make` and `curl` in path. The rest
of the tooling (gcc, qemu) will be handled by the build system. For extra convenience, of the tooling (gcc, qemu) will be handled by the build system. For extra convenience,
you could also use `bear` for generating "compile_commands.json". This is useful for helping you could also use `bear` for generating "compile_commands.json". This is useful for helping
clangd pick up the correct paths, and will result in better in-editor diagnostics and warnings. clangd pick up the correct paths, and will result in better in-editor diagnostics and warnings.
clang-format and find might also be useful for development.
```sh ```sh
make get_toolchain # Dont worry, is will land locally inside project directory make get_toolchain # Dont worry, is will land locally inside project directory

9
kern/include.mk Normal file
View file

@ -0,0 +1,9 @@
KERN_SRC := $(wildcard kern/*.c)
KERN_SRC += $(wildcard kern/*.S)
KERN_OBJ := $(KERN_SRC:.c=.o)
KERN_OBJ := $(KERN_OBJ:.S=.o)
include kern/libkern/include.mk
KERN_OBJ += $(LIBKERN_OBJ)

5
kern/libkern/include.mk Normal file
View file

@ -0,0 +1,5 @@
LIBKERN_SRC := $(wildcard kern/libkern/*.c)
LIBKERN_SRC += $(wildcard kern/libkern/*.S)
LIBKERN_OBJ := $(LIBKERN_SRC:.c=.o)
LIBKERN_OBJ := $(LIBKERN_OBJ:.S=.o)