47 lines
1.3 KiB
Makefile
47 lines
1.3 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
|
|
|
|
all: build
|
|
|
|
clean:
|
|
cargo clean
|
|
|
|
build: target/shade.iso
|
|
|
|
rustc:
|
|
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
|
|
|
|
target/llb/mb2_header.o: shadeos-llb/src
|
|
mkdir -p target/llb
|
|
$(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
|
|
$(ASM) $(ASMARGS) shadeos-llb/src/entry32.asm -o target/llb/entry32.o
|