|
|
|
CXXFLAGS := -m32 -ggdb -g3 -O1 -fno-pic -fno-rtti -fno-exceptions -std=c++23 \
|
|
|
|
-Wall -Wextra -pedantic -Werror
|
|
|
|
LDFLAGS := $(CXXFLAGS) -T link.ld -static -nostdlib -fno-use-cxa-atexit
|
|
|
|
|
|
|
|
CXXFILES := acpi.cpp \
|
|
|
|
ata.cpp \
|
|
|
|
boot.cpp \
|
|
|
|
gdt.cpp \
|
|
|
|
idt.cpp \
|
|
|
|
keyboard.cpp \
|
|
|
|
memmove.cpp \
|
|
|
|
memory.cpp \
|
|
|
|
multiboot.cpp \
|
|
|
|
pic.cpp \
|
|
|
|
pit.cpp \
|
|
|
|
tasking.cpp \
|
|
|
|
vgaterminal.cpp \
|
|
|
|
kernel.cpp
|
|
|
|
|
|
|
|
OBJS := $(subst .cpp,.o,$(CXXFILES))
|
|
|
|
|
|
|
|
all: myos.iso
|
|
|
|
|
|
|
|
myos.iso: myos.bin iso/boot/grub/grub.cfg
|
|
|
|
@echo " ISO " $@
|
|
|
|
@cp myos.bin iso/boot/
|
|
|
|
@grub-mkrescue -o myos.iso iso/
|
|
|
|
|
|
|
|
myos.bin: $(OBJS) link.ld
|
|
|
|
@echo " LD " $@
|
|
|
|
@g++ $(LDFLAGS) -o $@ $(OBJS)
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
@echo " CXX " $<
|
|
|
|
@g++ $(CXXFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo " CLEAN"
|
|
|
|
@rm -f $(OBJS) myos.bin myos.iso
|
|
|
|
|
|
|
|
run: myos.iso
|
|
|
|
@echo " QEMU"
|
|
|
|
@qemu-system-i386 -drive file=$<,index=2,media=cdrom -monitor stdio -no-reboot -s -S #-d int
|
|
|
|
|