git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
re-factored the makefile and improved qemu debug experience.
[lunaix-os.git]
/
lunaix-os
/
makefile
diff --git
a/lunaix-os/makefile
b/lunaix-os/makefile
index 2ff30c0eb64237e3c90822de8c5da038dfa66d73..4993318c3ec8ac4da4cb4f483fe4ef2b461da846 100644
(file)
--- a/
lunaix-os/makefile
+++ b/
lunaix-os/makefile
@@
-1,28
+1,9
@@
-OS_ARCH := x86
+include config/make-locations
+include config/make-os
+include config/make-cc
+include config/make-debug-tool
-BUILD_DIR := build
-KERNEL_DIR := kernel
-OBJECT_DIR := $(BUILD_DIR)/obj
-BIN_DIR := $(BUILD_DIR)/bin
-ISO_DIR := $(BUILD_DIR)/iso
-ISO_BOOT_DIR := $(ISO_DIR)/boot
-ISO_GRUB_DIR := $(ISO_BOOT_DIR)/grub
-
-INCLUDES_DIR := includes
INCLUDES := $(patsubst %, -I%, $(INCLUDES_DIR))
INCLUDES := $(patsubst %, -I%, $(INCLUDES_DIR))
-
-OS_NAME = lunaix
-OS_BIN = $(OS_NAME).bin
-OS_ISO = $(OS_NAME).iso
-
-CC := i686-elf-gcc
-AS := i686-elf-as
-
-O := -O2
-W := -Wall -Wextra
-CFLAGS := -std=gnu99 -ffreestanding $(O) $(W)
-LDFLAGS := -ffreestanding $(O) -nostdlib -lgcc
-
SOURCE_FILES := $(shell find -name "*.[cS]")
SRC := $(patsubst ./%, $(OBJECT_DIR)/%.o, $(SOURCE_FILES))
SOURCE_FILES := $(shell find -name "*.[cS]")
SRC := $(patsubst ./%, $(OBJECT_DIR)/%.o, $(SOURCE_FILES))
@@
-59,17
+40,22
@@
all-debug: O := -O0
all-debug: CFLAGS := -g -std=gnu99 -ffreestanding $(O) $(W) -fomit-frame-pointer
all-debug: LDFLAGS := -ffreestanding $(O) -nostdlib -lgcc
all-debug: clean $(BUILD_DIR)/$(OS_ISO)
all-debug: CFLAGS := -g -std=gnu99 -ffreestanding $(O) $(W) -fomit-frame-pointer
all-debug: LDFLAGS := -ffreestanding $(O) -nostdlib -lgcc
all-debug: clean $(BUILD_DIR)/$(OS_ISO)
- @i686-elf-objdump -D $(BIN_DIR)/$(OS_BIN) > dump
+ @echo "Dumping the disassembled kernel code to $(BUILD_DIR)/kdump.txt"
+ @i686-elf-objdump -S $(BIN_DIR)/$(OS_BIN) > $(BUILD_DIR)/kdump.txt
clean:
@rm -rf $(BUILD_DIR)
run: $(BUILD_DIR)/$(OS_ISO)
clean:
@rm -rf $(BUILD_DIR)
run: $(BUILD_DIR)/$(OS_ISO)
- @qemu-system-i386 -cdrom $(BUILD_DIR)/$(OS_ISO)
+ @qemu-system-i386 -cdrom $(BUILD_DIR)/$(OS_ISO) -monitor telnet::45454,server,nowait &
+ @sleep 1
+ @telnet 127.0.0.1 $(QEMU_MON_PORT)
debug-qemu: all-debug
@objcopy --only-keep-debug $(BIN_DIR)/$(OS_BIN) $(BUILD_DIR)/kernel.dbg
debug-qemu: all-debug
@objcopy --only-keep-debug $(BIN_DIR)/$(OS_BIN) $(BUILD_DIR)/kernel.dbg
- @qemu-system-i386 -s -S -kernel $(BIN_DIR)/$(OS_BIN) &
+ @qemu-system-i386 -s -S -kernel $(BIN_DIR)/$(OS_BIN) -monitor telnet::$(QEMU_MON_PORT),server,nowait &
+ @sleep 1
+ @$(QEMU_MON_TERM) -e "telnet 127.0.0.1 $(QEMU_MON_PORT)"
@gdb -s $(BUILD_DIR)/kernel.dbg -ex "target remote localhost:1234"
debug-bochs: all-debug
@gdb -s $(BUILD_DIR)/kernel.dbg -ex "target remote localhost:1234"
debug-bochs: all-debug