-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (63 loc) · 2.69 KB
/
Copy pathMakefile
File metadata and controls
91 lines (63 loc) · 2.69 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
TARGET = kernel.elf
ISO = muxos.iso
all: $(ISO)
boot.o: boot.s
nasm -f elf32 boot.s -o boot.o
switch.o: switch.s
nasm -f elf32 switch.s -o switch.o
user_entry.o: user_entry.s
nasm -f elf32 user_entry.s -o user_entry.o
user_prog.o: user_prog.s
nasm -f elf32 user_prog.s -o user_prog.o
user_task.o: user_task.c
gcc -m32 -ffreestanding -fno-builtin -fno-pic -c user_task.c -o user_task.o
user_start.o: user_start.s
nasm -f elf32 user_start.s -o user_start.o
user_simple.o: user_simple.s
nasm -f elf32 user_simple.s -o user_simple.o
user_prog_c.o: user_prog_c.s
nasm -f elf32 user_prog_c.s -o user_prog_c.o
userlib.o: userlib.c
gcc -m32 -ffreestanding -fno-builtin -fno-pic -O0 -c userlib.c -o userlib.o
user_crt.o: user_crt.s
nasm -f elf32 user_crt.s -o user_crt.o
kernel.o: kernel.c vga.h
gcc -m32 -ffreestanding -fno-builtin -c kernel.c -o kernel.o
vga.o: vga.c vga.h
gcc -m32 -ffreestanding -fno-builtin -c vga.c -o vga.o
gdt.o: gdt.c gdt.h
gcc -m32 -ffreestanding -fno-builtin -c gdt.c -o gdt.o
idt.o: idt.c idt.h isr.c
gcc -m32 -ffreestanding -fno-builtin -c idt.c -o idt.o
isr.o: isr.c
gcc -m32 -ffreestanding -fno-builtin -c isr.c -o isr.o
pic.o: pic.c pic.h io.h
gcc -m32 -ffreestanding -fno-builtin -c pic.c -o pic.o
keyboard.o: keyboard.c keyboard.h pic.h io.h vga.h
gcc -m32 -ffreestanding -fno-builtin -mgeneral-regs-only -c keyboard.c -o keyboard.o
console.o: console.c console.h vga.h
gcc -m32 -ffreestanding -fno-builtin -c console.c -o console.o
pmm.o: pmm.c pmm.h
gcc -m32 -ffreestanding -fno-builtin -c pmm.c -o pmm.o
vmm.o: vmm.c vmm.h pmm.h
gcc -m32 -ffreestanding -fno-builtin -c vmm.c -o vmm.o
serial.o: serial.c serial.h io.h
gcc -m32 -ffreestanding -fno-builtin -c serial.c -o serial.o
process.o: process.c process.h
gcc -m32 -ffreestanding -fno-builtin -c process.c -o process.o
syscall.o: syscall.c syscall.h
gcc -m32 -ffreestanding -fno-builtin -c syscall.c -o syscall.o
tss.o: tss.c tss.h gdt.h
gcc -m32 -ffreestanding -fno-builtin -c tss.c -o tss.o
$(TARGET): boot.o kernel.o vga.o gdt.o idt.o isr.o pic.o keyboard.o console.o pmm.o vmm.o serial.o process.o switch.o syscall.o tss.o user_entry.o user_crt.o userlib.o linker.ld
gcc -m32 -T linker.ld -o $(TARGET) -ffreestanding -nostdlib boot.o kernel.o vga.o gdt.o idt.o isr.o pic.o keyboard.o console.o pmm.o vmm.o serial.o process.o switch.o syscall.o tss.o user_entry.o user_crt.o userlib.o
$(ISO): $(TARGET)
mkdir -p iso/boot/grub
cp $(TARGET) iso/boot/
printf 'set timeout=1\nset default=0\nmenuentry "MuxOS" { multiboot /boot/$(TARGET) }\n' > iso/boot/grub/grub.cfg
grub-mkrescue -o $(ISO) iso
run: $(ISO)
qemu-system-i386 -cdrom $(ISO) -serial stdio -display gtk
clean:
rm -f *.o $(TARGET) $(ISO)
rm -rf iso