summaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
authorAlexey Gavrilov <rebovas@yahoo.com>2024-02-22 14:18:39 +0700
committerAlexey Gavrilov <rebovas@yahoo.com>2024-02-22 14:18:39 +0700
commitcbcbf6e7d614ecf94dd7e1b9033f8d599f48662e (patch)
tree59872849d347794cc58c8ad3aa201a14e0db526f /makefile
parentc18781e37e6bfe153e7c0f2bc8b04df0aecf151d (diff)
Implement support of cpuid instruction + include folder + some updates
Diffstat (limited to 'makefile')
-rw-r--r--makefile11
1 files changed, 6 insertions, 5 deletions
diff --git a/makefile b/makefile
index ab744ff..c9e0857 100644
--- a/makefile
+++ b/makefile
@@ -2,9 +2,9 @@ CC = i686-elf-g++
LD = ld
ASM = nasm
# test -O2 flag
-CFLAGS = -c -m32 -Wall -ffreestanding -nostdinc -nostdlib -lgcc
+CFLAGS = -c -m32 -Wall -ffreestanding -nostdinc -nostdlib
AFLAGS = -f elf32
-LDFLAGS = -m elf_i386
+LDFLAGS = -m elf_i386 -L$(GCC_PATH) -lgcc
QEMUFLAGS =
CFILES = $(shell find ./ -type f \( -name \*.cpp -o -name \*.c \))
@@ -12,6 +12,7 @@ AFILES = $(shell find ./ -type f \( -iname \*.s -o -name \*.asm \))
LDFILE = $(shell find ./ -type f -name *.ld)
SOURCE_FILES = $(CFILES) $(AFILES)
OBJ_FILES = $(addprefix $(BDIR)/, $(addsuffix .o, $(basename $(SOURCE_FILES))))
+INCLUDE = ./include
ifeq ($(DEBUG), true)
CFLAGS := -g3 $(CFLAGS)
@@ -28,12 +29,12 @@ build: startbuild $(SOURCE_FILES)
echo $(AFLAGS)
echo $(CFLAGS)
@echo "Link object files..."
- $(LD) $(LDFLAGS) -o $(OS_BINARY) -T $(LDFILE) $(OBJ_FILES)
+ $(LD) -o $(OS_BINARY) -T $(LDFILE) $(OBJ_FILES) $(LDFLAGS)
@echo "Project was built"
$(CFILES):
mkdir -p $(BDIR)/$(@D)
- $(CC) $(CFLAGS) -o $(BDIR)/$(addsuffix .o, $(basename $@)) $@
+ $(CC) $(CFLAGS) -I $(INCLUDE) -o $(BDIR)/$(addsuffix .o, $(basename $@)) $@
$(AFILES):
mkdir -p $(BDIR)/$(@D)
@@ -54,6 +55,6 @@ clean:
rm -rf ./iso/os/kernel.bin
run:
- qemu-system-i386 $(QEMUFLAGS) -cdrom ./$(BDIR)/kernel.iso
+ qemu-system-x86_64 $(QEMUFLAGS) -cdrom ./$(BDIR)/kernel.iso
all: clean build install run