-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (34 loc) · 1.33 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
.PHONY: run clean
run: bin/kernel.bin32
qemu-system-x86_64 -kernel $<
clean:
rm -rf bin/
rm -rf lib/patched
rm -rf lib/core/target
rm -rf lib/rlibc/target
rm -rf src/rust/target
bin/.dir_created:
mkdir -p bin/
touch $@
lib/patched/.dir_created:
mkdir -p lib/patched/
touch $@
# Basic Multiboot only understands elf32
bin/kernel.bin32: bin/kernel.bin
objcopy -I elf64-x86-64 -O elf32-i386 $< $@
bin/kernel.bin: bin/.dir_created bin/boot.o bin/boot64.a bin/multiboot.o src/ld/kernel.ld
ld -n --gc-sections -m elf_x86_64 -o $@ -T src/ld/kernel.ld bin/boot.o bin/boot64.a bin/multiboot.o
bin/boot.o: src/asm/boot.asm bin/.dir_created
nasm -f elf64 -o $@ $<
bin/multiboot.o: src/asm/multiboot.asm bin/.dir_created
nasm -f elf64 -o $@ $<
bin/boot64.a: src/rust/target/x86_64-unknown-none-gnu/debug/libkernel.a bin/.dir_created
cp $< $@
src/rust/target/x86_64-unknown-none-gnu/debug/libkernel.a: src/rust/src/kernel.rs src/rust/src/port.rs src/rust/src/gdt.rs lib/patched/core/.patch_applied
cargo build --target x86_64-unknown-none-gnu --manifest-path src/rust/Cargo.toml --verbose
lib/patched/core/.dir_created: lib/patched/.dir_created
cp -r submodules/rust/src/libcore/ lib/patched/core
touch $@
lib/patched/core/.patch_applied: lib/patched/core/.dir_created lib/core_nofp.patch
patch -d lib/patched/ -p0 < lib/core_nofp.patch
touch $@