rustyshade/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

ASM := nasm
ASMARGS := -f elf64
LD := x86_64-elf-ld
LDARGS := --nmagic
2023-01-31 01:59:44 +00:00
CARGO_ENV := release
CARGO_EXTRA_ARG := --release
.PHONY = target clean run rustc build debug
default: build
2023-04-01 15:06:07 +00:00
all: build
clean:
cargo clean
build: target/shade.iso
rustc:
2023-04-01 15:06:07 +00:00
RUST_TARGET_PATH=$(shell pwd) cargo build -p shadeos-kernel $(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
2023-04-01 15:06:07 +00:00
target/llb/mb2_header.o: shadeos-llb/src
mkdir -p target/llb
2023-04-01 15:06:07 +00:00
$(ASM) $(ASMARGS) shadeos-llb/src/mb2_header.asm -o target/llb/mb2_header.o
target/llb/entry32.o: shadeos-llb/src
mkdir -p target/llb
2023-04-01 15:06:07 +00:00
$(ASM) $(ASMARGS) shadeos-llb/src/entry32.asm -o target/llb/entry32.o