45 lines
1.2 KiB
Makefile
45 lines
1.2 KiB
Makefile
ASM := nasm
|
|
ASMARGS := -f elf64
|
|
|
|
LD := x86_64-elf-ld
|
|
LDARGS := --nmagic
|
|
|
|
CARGO_ENV := release
|
|
CARGO_EXTRA_ARG := --release
|
|
|
|
.PHONY = target clean run rustc build debug
|
|
default: build
|
|
|
|
clean:
|
|
cargo clean
|
|
|
|
build: target/shade.iso
|
|
|
|
rustc:
|
|
RUST_TARGET_PATH=$(shell pwd) cargo build $(CARGO_EXTRA_ARG)
|
|
|
|
run: target/shade.iso
|
|
qemu-system-x86_64 -cdrom target/shade.iso
|
|
debug: target/shade.iso
|
|
qemu-system-x86_64 -cdrom target/shade.iso -s -S
|
|
|
|
target/shade.iso: target/shade.bin iso/boot/grub/grub.cfg
|
|
cp -r iso target
|
|
cp target/shade.bin target/iso/boot/shade.bin
|
|
cd target
|
|
cd target && grub-mkrescue -o shade.iso iso
|
|
|
|
|
|
target/shade.bin: target/llb/entry32.o target/llb/mb2_header.o rustc
|
|
$(LD) $(LDARGS) --output=target/shade.bin --script=linker.ld target/llb/entry32.o target/llb/mb2_header.o target/x86_64-unknown-shadeos-gnu/$(CARGO_ENV)/libshadeos.a
|
|
|
|
target/llb.a: target/llb/mb2_header.o target/llb/entry32.o
|
|
mkdir -p target/llb
|
|
ar rvs target/llb.a target/llb/mb2_header.o target/llb/entry32.o
|
|
|
|
target/llb/mb2_header.o: src/llb/mb2_header.asm
|
|
mkdir -p target/llb
|
|
$(ASM) $(ASMARGS) src/llb/mb2_header.asm -o target/llb/mb2_header.o
|
|
target/llb/entry32.o: src/llb/entry32.asm
|
|
mkdir -p target/llb
|
|
$(ASM) $(ASMARGS) src/llb/entry32.asm -o target/llb/entry32.o
|