summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 27 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0b534fb..e4c0022 100644
--- a/Makefile
+++ b/Makefile
@@ -22,9 +22,21 @@ KERNEL := bin/core
K_OBJS := \
kernel/entry.o \
kernel/cxx/constructors.o \
- kernel/cxx/icxxabi.o
+ kernel/cxx/icxxabi.o \
+ kernel/utils.o \
+ kernel/io/logger/base.o \
+ kernel/amd64/io/com1.o
+K_SRCS := $(patsubst %.o,%.cxx,$(K_OBJS))
+K_ASM_OBJS := \
+ kernel/amd64/io/ports.o
K_LINKSCRIPT := kernel/ldscript
+CPPSTDDIRS := \
+ vendor/x86_64-elf/include/c++/14.2.0 \
+ vendor/x86_64-elf/include/c++/14.2.0/x86_64-elf \
+ vendor/x86_64-elf/include/c++/14.2.0/backward
+CPPSTD := $(addprefix -I ,$(CPPSTDDIRS))
+
BINARIES := \
$(KERNEL)
@@ -35,10 +47,11 @@ OVMF_ROOT := /usr/share/qemu
all: hinterOS.iso
run:
- qemu-system-x86_64 --bios $(OVMF_ROOT)/ovmf-x86_64.bin -cdrom hinterOS.iso
+ qemu-system-x86_64 --serial stdio --bios $(OVMF_ROOT)/ovmf-x86_64.bin -cdrom hinterOS.iso
clean:
- find kernel -type f -name '*.o' -exec rm {} +
+ - find kernel -type f -name '*.d' -exec rm {} +
- rm hinterOS.iso
- rm $(BINARIES)
@@ -59,10 +72,19 @@ hinterOS.iso: $(BINARIES)
iso -o $@
vendor/limine/limine bios-install $@
-$(KERNEL): $(K_OBJS)
+$(KERNEL): $(K_OBJS) $(K_ASM_OBJS)
rm -rf bin
mkdir -p bin
- $(LD) -o $@ -T$(K_LINKSCRIPT) $^
+ $(LD) -o $@ -T $(K_LINKSCRIPT) $^
+
+.SECONDEXPANSION:
+$(K_OBJS): %.o: %.cxx %.d
+ $(CC) -c $(CFLAGS) -MT $@ -MMD -MP -MF $(basename $<).d -I kernel $(CPPSTD) $< -o $@
-$(K_OBJS): %.o: %.cxx
+$(K_ASM_OBJS): %.o: %.S
$(CC) -c $(CFLAGS) $^ -o $@
+
+DEPFILES := $(K_SRCS:%.cxx=%.d)
+$(DEPFILES):
+
+-include $(wildcard $(DEPFILES))