-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (33 loc) · 748 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 隐含规则
.SUFFIXES: .s
.PHONY:clean
#宏定义
OBJPATH=obj/
IMG=sapphireos.img
SUBDIRS= mbr loader qemu
all:$(SUBDIRS)
#编译
mbr:mbr/*.s
@nasm -i include -f bin -g -l $(OBJPATH)[email protected]\
-O0 -o $(OBJPATH)[email protected] $^
@echo $@ make success.
@dd if=$(OBJPATH)[email protected] of=$(OBJPATH)$(IMG) \
conv=notrunc
@echo $@ write img
loader:loader/*.s
@nasm -i include -f bin -g -l $(OBJPATH)[email protected]\
-O0 -o $(OBJPATH)[email protected] $^
@echo $@ make success.
@dd if=$(OBJPATH)[email protected] of=$(OBJPATH)$(IMG) \
seek=1 conv=notrunc
@echo $@ write img
#虚拟机
qemu:
@qemu-system-x86_64 \
-drive file=$(OBJPATH)$(IMG),format=raw \
-monitor stdio
bochs:
@bochs -f bochsrc
#清理文件
clean:
@rm -rf $(OBJPATH)*.o $(OBJPATH)*.lst $(OBJPATH)*.bin