From c18781e37e6bfe153e7c0f2bc8b04df0aecf151d Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Sat, 4 Nov 2023 10:09:44 +0700 Subject: Support for GDT has been written + add makefile debug mode --- makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'makefile') diff --git a/makefile b/makefile index 71a7a6c..ab744ff 100644 --- a/makefile +++ b/makefile @@ -5,6 +5,7 @@ ASM = nasm CFLAGS = -c -m32 -Wall -ffreestanding -nostdinc -nostdlib -lgcc AFLAGS = -f elf32 LDFLAGS = -m elf_i386 +QEMUFLAGS = CFILES = $(shell find ./ -type f \( -name \*.cpp -o -name \*.c \)) AFILES = $(shell find ./ -type f \( -iname \*.s -o -name \*.asm \)) @@ -12,12 +13,20 @@ LDFILE = $(shell find ./ -type f -name *.ld) SOURCE_FILES = $(CFILES) $(AFILES) OBJ_FILES = $(addprefix $(BDIR)/, $(addsuffix .o, $(basename $(SOURCE_FILES)))) +ifeq ($(DEBUG), true) + CFLAGS := -g3 $(CFLAGS) + AFLAGS := -g $(AFLAGS) + QEMUFLAGS := -s -S $(QEMUFLAGS) +endif + OS_BINARY = $(BDIR)/kernel.bin BDIR = ./build .PHONY: install $(SOURCE_FILES) build: startbuild $(SOURCE_FILES) + echo $(AFLAGS) + echo $(CFLAGS) @echo "Link object files..." $(LD) $(LDFLAGS) -o $(OS_BINARY) -T $(LDFILE) $(OBJ_FILES) @echo "Project was built" @@ -45,4 +54,6 @@ clean: rm -rf ./iso/os/kernel.bin run: - qemu-system-i386 -cdrom ./$(BDIR)/kernel.iso + qemu-system-i386 $(QEMUFLAGS) -cdrom ./$(BDIR)/kernel.iso + +all: clean build install run -- cgit v1.2.3