1 Star 0 Fork 0

WangEP / My_Small_OS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
makefile 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
WangEP 提交于 2018-03-25 08:27 . cp 5 part
#!Makefile
C_SOURCES = $(shell find -name "*.c")
C_OBJECTS = $(patsubst %.c, %.o, $(C_SOURCES))
S_SOURCES = $(shell find -name "*.s")
S_OBJECTS = $(patsubst %.s, %.o, $(S_SOURCES))
CC = gcc
LD = ld
ASM = nasm
C_FLAGS = -O2 -c -Wall -m32 -ggdb -gstabs+ -nostdinc -fno-builtin -fno-stack-protector -I include
LD_FLAGS = -T script/kernel.ld -m elf_i386 -nostdlib
ASM_FLAGS = -f elf -g -F stabs
all: $(S_OBJECTS) $(C_OBJECTS) link update_image
.c.o:
@echo compile c file $< ...
$(CC) $(C_FLAGS) $< -o $@
.s.o:
@echo compile asm file $< ...
$(ASM) $(ASM_FLAGS) $<
link:
@echo compile kernal file ..
$(LD) $(LD_FLAGS) $(S_OBJECTS) $(C_OBJECTS) -o my_kernel
.PHONY: clean
clean:
$(RM) $(S_OBJECTS) $(C_OBJECTS) my_kernel
.PHONY:update_image
update_image:
sudo mount floppy.img /mnt/kernel
sudo cp my_kernel /mnt/kernel/my_kernel
sleep 1
sudo umount /mnt/kernel
.PHONY:mount_image
mount_image:
sudo mount floppy.img /mnt/kernel
.PHONY:umount_image
umount_image:
sudo umount /mnt/kernel
.PHONY:qemu
qemu:
qemu-system-i386 -fda floppy.img -boot a
.PHONY:bochs
bochs:
bochs -f tools/bochsrc.txt
.PHONY:debug
debug:
qemu-system-i386 -S -s -fda floppy.img -boot a &
sleep 1
cgdb -x tools/gdbinit
C
1
https://gitee.com/WangEP/My_Small_OS.git
git@gitee.com:WangEP/My_Small_OS.git
WangEP
My_Small_OS
My_Small_OS
master

搜索帮助