diff --git a/Makefile b/Makefile index 5e1b348..96da4a5 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,14 @@ assembly_source_files := $(wildcard src/arch/$(arch)/*.asm) assembly_object_files := $(patsubst src/arch/$(arch)/%.asm, \ build/arch/$(arch)/%.o, $(assembly_source_files)) +ifeq ($(shell uname), Linux) + prefix := +else + prefix := x86_64-elf- +endif + +ld := $(prefix)ld + .PHONY: all clean run iso kernel all: $(kernel) @@ -18,7 +26,7 @@ clean: @rm -r build run: $(iso) - @qemu-system-x86_64 -cdrom $(iso) + @qemu-system-$(arch) -cdrom $(iso) iso: $(iso) @@ -30,7 +38,7 @@ $(iso): $(kernel) $(grub_cfg) @rm -r build/isofiles $(kernel): kernel $(rust_os) $(assembly_object_files) $(linker_script) - @ld -n --gc-sections -T $(linker_script) -o $(kernel) \ + @$(ld) -n --gc-sections -T $(linker_script) -o $(kernel) \ $(assembly_object_files) $(rust_os) kernel: