-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefileISO
executable file
·48 lines (41 loc) · 1.26 KB
/
MakefileISO
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
# Makefile to Generate an ISO Image of oudadOS
# Build OS's Files
cpp_params = -O0 -m32 -Iinclude -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings
as_params = --32
ld_params = -melf_i386
o_files = obj/loader.o \
obj/gdt.o \
obj/drivers/driver.o \
obj/com/port.o \
obj/com/interruptstubs.o \
obj/com/interrupts.o \
obj/com/pci.o \
obj/drivers/keyboard.o \
obj/drivers/mouse.o \
obj/kernel.o
obj/%.o: src/%.cpp
mkdir -p $(@D)
gcc $(cpp_params) -c -o $@ $<
obj/%.o: src/%.s
mkdir -p $(@D)
as $(as_params) -o $@ $<
oudadOS.bin: linker.ld $(o_files)
ld $(ld_params) -T $< -o $@ $(o_files)
install: oudadOS.bin
sudo cp $< /boot/oudadOS.bin
oudadOS.iso: oudadOS.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
echo 'menuentry "oudadOS"{' >> iso/boot/grub/grub.cfg
echo ' multiboot /boot/oudadOS.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
.PHONY: clean
clean:
rm -f $(o_files) oudadOS.iso oudadOS.bin