-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (34 loc) · 1.23 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
CC = gcc
CFLAGS = -Wall -Wextra -Wpedantic -std=gnu99 -ffreestanding
OPTFLAGS = -O0
64BITFLAGS = -mno-red-zone -mno-mmx -mno-sse -mno-sse2
AS = as
ASFLAGS = -msyntax=intel -mnaked-reg
LINKER = linker.ld
LDFLAGS= -lgcc -nostdlib
# NOTE: in some installs you need to specify the path of the library files
#LDFLAGS += -L/lib/gcc/x86_64-elf/11.2.0/libgcc.a
# ALT-2, then type quit
QEMUCMD = qemu-system-x86_64
QEMUFLAGS = -curses -drive format=raw,file=
OBJDIR = ./obj
OBJLIST = ./obj/bootloader.o ./obj/Kernel.o ./obj/runtime.o
BUILDDIR = ./build
BB.bin : $(BUILDDIR) $(OBJLIST)
$(CC) $(OBJLIST) -o $(BUILDDIR)/BB.bin $(CFLAGS) $(LDFLAGS) $(64BITFLAGS) $(DIRECTIVES) -T $(LINKER) $(OPTFLAGS)
qemu: BB.bin
$(QEMUCMD) $(QEMUFLAGS)$(BUILDDIR)/BB.bin
$(OBJDIR)/Kernel.o: Kernel.java runtime.c
./build_kernel.o.sh
# $(OBJDIR)/vga.o : vga.c $(OBJDIR)
# $(CC) -c vga.c -o $(OBJDIR)/vga.o $(CFLAGS) $(OPTFLAGS) $(DIRECTIVES)
$(OBJDIR)/bootloader.o : bootloader.asm $(OBJDIR)
$(AS) bootloader.asm -o $(OBJDIR)/bootloader.o $(ASFLAGS)
$(BUILDDIR) :
test ! -d $(BUILDDIR) && mkdir $(BUILDDIR)
$(OBJDIR) :
test ! -d $(OBJDIR) && mkdir $(OBJDIR)
clean :
rm -rf generated-llvm
rm -rf $(OBJLIST)
rm -f $(BUILDDIR)/BB.bin