-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (53 loc) · 1.67 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
vpath %.asm src
vpath %.ld src
vpath %.hs include
vpath %.o obj
vpath %.bin bin
SRC = src
INC = include
OBJ = obj
BIN = bin
MOUNT = /mnt
AS = nasm
AFLAGS = -f elf32 -w+all -w+error -w-unknown-warning -i $(INC)/
LD = i386-elf-ld
LFLAGS = -Map=./ --fatal-warnings
QEMU = qemu-system-i386
QFLAGS = -curses -drive file=zeros.iso,format=raw -s -enable-kvm
OBJS = ext2.o ide.o interrupts.o kb.o kernel0.o kernel1.o mbr.o panic.o sys.o
OBJS += tests.o vga.o
.PHONY: all relink install run
all: kernel.bin
relink: $(OBJS)
$(LD) $(LFLAGS) -T kernel.ld $^ -o $(BIN)/kernel.bin
install: all
cp $(BIN)/kernel.bin $(MOUNT)/boot/
sync $(MOUNT)
run:
$(QEMU) $(QFLAGS)
runx:
command startx ./qemu_zeros.xinitrc -- vt$(shell tty | sed -e 's|/dev/tty||')
$(BIN)/kernel.bin: $(OBJS)
$(LD) $(LFLAGS) -T kernel.ld $^ -o $@
$(OBJ)/ext2.o: ext2.asm ext2.hs ide.hs mbr.hs misc.hs sys.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/ide.o: ide.asm ide.hs misc.hs sys.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/interrupts.o: interrupts.asm idt.hs kb.hs panic.hs vga.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/kb.o: kb.asm kb.hs idt.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/kernel0.o: kernel0.asm gdt.hs ide.hs idt.hs kb.hs multiboot.hs tss.hs vga.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/kernel1.o: kernel1.asm ext2.hs ide.hs misc.hs panic.hs sys.hs tests.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/mbr.o: mbr.asm mbr.hs ide.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/panic.o: panic.asm panic.hs misc.hs sys.hs vga.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/sys.o: sys.asm sys.hs kb.hs vga.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/tests.o: tests.asm tests.hs gdt.hs misc.hs panic.hs sys.hs
$(AS) $(AFLAGS) $< -o $@
$(OBJ)/vga.o: vga.asm vga.hs
$(AS) $(AFLAGS) $< -o $@