-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
72 lines (67 loc) · 2.01 KB
/
makefile
File metadata and controls
72 lines (67 loc) · 2.01 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
# the second param tells the compiler to look for the headers in the include directory
# reason why include is done with corner braces
# definition of flags:
# -fno-use-cxa-atexit: no memory management
# -nostdlib: no glibc library
# -fno-rtti: no runtime type identification
# -fno-leading-underscore (minor): without this the loader would have to call _kernelMain
GPPPARAMS = -m32 -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings
ASPARAMS = --32
LDPARAMS = -melf_i386
objects = obj/loader.o \
obj/gdt.o \
obj/heap.o \
obj/drivers/driver.o \
obj/hardwarecomm/port.o \
obj/hardwarecomm/interruptstubs.o \
obj/hardwarecomm/interrupts.o \
obj/drivers/syscalls.o \
obj/multitasking.o \
obj/drivers/amd_am79c973.o \
obj/hardwarecomm/pci.o \
obj/drivers/keyboard.o \
obj/drivers/mouse.o \
obj/drivers/vga.o \
obj/drivers/ata.o \
obj/filesystem/msdospart.o \
obj/filesystem/fat.o \
obj/gui/widget.o \
obj/gui/window.o \
obj/gui/desktop.o \
obj/net/ethframe.o \
obj/net/arp.o \
obj/net/ipv4.o \
obj/net/icmp.o \
obj/net/udp.o \
obj/net/tcp.o \
obj/kernel.o
obj/%.o: src/%.cpp
mkdir -p $(@D)
g++ $(GPPPARAMS) -o $@ -c $<
obj/%.o: src/%.s
mkdir -p $(@D)
as $(ASPARAMS) -o $@ $<
rexKernel.bin: linker.ld $(objects)
ld $(LDPARAMS) -T $< -o $@ $(objects)
install: rexKernel.bin
sudo cp $< /boot/rexKernel.bin
rexKernel.iso: rexKernel.bin
mkdir iso
mkdir iso/boot
mkdir iso/boot/grub
cp $< iso/boot/
echo 'set timeout=0' >> iso/boot/grub/grub.cfg
echo 'set default=0' >> iso/boot/grub/grub.cfg
# The menuentry text is showing up in the heap
echo 'menuentry "Rex OS" {' >> iso/boot/grub/grub.cfg
echo ' multiboot /boot/rexKernel.bin' >> iso/boot/grub/grub.cfg
echo ' boot' >> iso/boot/grub/grub.cfg
echo '}' >> iso/boot/grub/grub.cfg
grub-mkrescue --output=$@ iso
rm -rf iso
run: rexKernel.iso
(killall VirtualBox && sleep 1) || true
VBoxManage startvm "RexOS" &
.PHONY: clean
clean:
rm -rf obj rexKernel.bin rexKernel.iso