-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (48 loc) · 1.59 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
71
72
AR = $(HOME)/opt/cross/bin/x86_64-elf-ar
LD = $(HOME)/opt/cross/bin/x86_64-elf-ld
CC = $(HOME)/opt/cross/bin/x86_64-elf-gcc
AS = $(HOME)/opt/cross/bin/x86_64-elf-as
CXX = $(HOME)/opt/cross/bin/x86_64-elf-g++
LIBS = -L$(HOME)/opt/cross/lib/gcc/x86_64-elf/9.2.0 -lgcc
CFLAGS = -ffreestanding -fno-builtin -O2 -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mcmodel=large -c
CXXFLAGS = -O2 -ffreestanding -fno-builtin -fno-rtti -fno-exceptions \
-mno-red-zone -mno-mmx -mno-sse -mno-sse2 \
-mcmodel=kernel -c
LDFLAGS = -n -T linker.ld
OBJECTS = boot.o debug.o heap.o \
memory.o rtc.o \
main.o string.o \
fbdev.o keyboard.o \
ps2.o box.o
TARGET = test1
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)
%.o: %.c
$(CC) -o $@ $(CFLAGS) $<
%.o: %.asm
nasm -felf64 -o $@ $<
install: $(TARGET)
e2cp -v init64 part1:/elf
clean:
rm -fv *.o $(TARGET)
run: $(TARGET)
e2cp -v $(TARGET) part1:/elf
cat mbr part1 > disk0
qemu-system-x86_64 -m 1024 -nographic -smp 4 -drive file=disk0,format=raw -no-reboot
rm -fv disk0
qemu: $(TARGET)
e2cp -v $(TARGET) part1:/elf
cat mbr part1 > disk0
qemu-system-x86_64 -m 1024 -serial stdio -drive file=disk0,format=raw -smp 4 -no-reboot
rm -fv disk0
egl: $(TARGET)
e2cp -v $(TARGET) part1:/elf
cat mbr part1 > disk0
qemu-system-x86_64 -m 1024 -serial stdio -drive file=disk0,format=raw -display egl-headless -no-reboot
rm -fv disk0
curses: $(TARGET)
e2cp -v $(TARGET) part1:/elf
cat mbr part1 > disk0
qemu-system-x86_64 -m 1024 -drive file=disk0,format=raw -smp 4 -no-reboot -display curses
rm -fv disk0