-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (44 loc) · 1.62 KB
/
Copy pathMakefile
File metadata and controls
55 lines (44 loc) · 1.62 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
GPP = x86_64-elf-g++
AS = x86_64-elf-as
LD = x86_64-elf-ld
GPPFLAGS = -m32 -fno-pic -fno-stack-protector -fno-use-cxa-atexit -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-leading-underscore -Wno-write-strings -Iinclude
ASPARAMS = --32
LDPARAMS = -melf_i386
objects = build/loader.o build/basics/gdt.o build/hardware/pci.o build/hardware/port.o build/basics/interruptstubs.o build/basics/interrupts.o build/drivers/driver.o build/drivers/keyboard.o build/drivers/mouse.o build/lib/stdlib.o build/kernel.o
build/%.o: src/%.cpp structure
@$(GPP) $(GPPFLAGS) -o $@ -c $<
build/%.o: src/%.s structure
@$(AS) $(ASPARAMS) -o $@ $<
betterKernel.bin: linker.ld $(objects) structure
@$(LD) $(LDPARAMS) -T $< -o $@ $(objects)
betterKernel.iso: betterKernel.bin structure
@mkdir -p iso/
@mkdir -p iso/boot/
@mkdir -p iso/boot/grub/
@cp betterKernel.bin iso/boot/
@> iso/boot/grub/grub.cfg
@echo 'set timeout=0' >> iso/boot/grub/grub.cfg
@echo 'set default=0' >> iso/boot/grub/grub.cfg
@echo '' >> iso/boot/grub/grub.cfg
@echo 'menuentry "Better OS" {' >> iso/boot/grub/grub.cfg
@echo ' multiboot /boot/betterKernel.bin' >> iso/boot/grub/grub.cfg
@echo ' boot' >> iso/boot/grub/grub.cfg
@echo '}' >> iso/boot/grub/grub.cfg
@grub-mkrescue --output=build/betterKernel.iso iso
@rm -rf iso *.o *.bin build/*.o
@echo "We created an .iso file successfully, build/$@"
.PHONY: clean
clean:
@rm -rf *.o *.bin *.iso iso/
@rm -rf build
commit:
@make clean
@git add .
@git commit -m "$(MSG)"
@git push -u master
structure:
@mkdir -p build
@mkdir -p build/basics
@mkdir -p build/hardware
@mkdir -p build/drivers
@mkdir -p build/lib