summaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
authorAlexey Gavrilov <rebovas@yahoo.com>2023-11-04 10:09:44 +0700
committerAlexey Gavrilov <rebovas@yahoo.com>2023-11-04 10:09:44 +0700
commitc18781e37e6bfe153e7c0f2bc8b04df0aecf151d (patch)
tree42bb0e00e58ccf85aa3b93c20347d4939464066e /makefile
parenta93807ad337dd982c49f898cd5205d2b028f365d (diff)
Support for GDT has been written + add makefile debug mode
Diffstat (limited to 'makefile')
-rw-r--r--makefile13
1 files changed, 12 insertions, 1 deletions
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