-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (36 loc) · 1.27 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
# Copyright (c) 2019 Giovanni Giacomo. All Rights Reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
ASMFLAGS = --32
CXXFLAGS = -m32 -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore
LDFLAGS = -melf_i386
objects = loader.o gdt.o iostream.o driver.o port.o stub.o interrupt.o keyboard.o mouse.o kernel.o
%.o: src/*/%.cpp
mkdir -p obj
g++ $(CXXFLAGS) -o obj/$@ -c $< -Iinclude/
%.o: src/*/%.s
mkdir -p obj
as $(ASMFLAGS) -o obj/$@ $<
cassio.bin: src/linker.ld $(objects)
mkdir -p bin
ld $(LDFLAGS) -T $< -o bin/$@ $(addprefix obj/, $(objects))
cassio.iso: cassio.bin
mkdir iso
mkdir iso/boot
mkdir iso/boot/grub
cp bin/$< iso/boot/
echo 'set default=0' > iso/boot/grub/grub.cfg
echo 'set timeout=0' >> iso/boot/grub/grub.cfg
echo '' >> iso/boot/grub/grub.cfg
echo 'menuentry "CassiOS" {' >> iso/boot/grub/grub.cfg
echo ' multiboot /boot/cassio.bin' >> iso/boot/grub/grub.cfg
echo ' boot' >> iso/boot/grub/grub.cfg
echo '}' >> iso/boot/grub/grub.cfg
echo '' >> iso/boot/grub/grub.cfg
grub-mkrescue --output=bin/$@ iso
rm -rf iso
run: cassio.iso
VirtualBox --startvm "CassiOS" &
.PHONY: clean
clean:
rm -rf $(addprefix obj/, $(objects)) bin/cassio.bin bin/cassio.iso