1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 16:36:18 +04:00
rCore/bootloader/Makefile

48 lines
853 B
Makefile
Raw Normal View History

2019-03-04 11:22:19 +04:00
arch ?= aarch64
mode ?= debug
target := $(arch)
2019-03-05 20:46:01 +04:00
payload ?=
2019-03-04 11:22:19 +04:00
bootloader := target/$(target)/$(mode)/rcore-bootloader
2019-03-05 20:46:01 +04:00
ifeq ($(arch), x86_64)
ifeq ($(uname), Darwin)
prefix := x86_64-elf-
endif
else ifeq ($(arch), riscv32)
prefix := riscv64-unknown-elf-
else ifeq ($(arch), riscv64)
prefix := riscv64-unknown-elf-
else ifeq ($(arch), aarch64)
prefix ?= aarch64-none-elf-
ifeq (,$(shell which $(prefix)ld))
prefix := aarch64-elf-
endif
endif
ld := $(prefix)ld
objdump := $(prefix)objdump
objcopy := $(prefix)objcopy
cc := $(prefix)gcc
as := $(prefix)as
gdb := $(prefix)gdb
strip := $(prefix)strip
export CC = $(cc)
export PAYLOAD = $(payload)
2019-03-04 11:22:19 +04:00
build_args := --target=targets/$(arch).json
ifeq ($(mode), release)
build_args += --release
endif
.PHONY: all clean
2019-03-05 20:46:01 +04:00
all: bootloader
2019-03-04 11:22:19 +04:00
2019-03-05 20:46:01 +04:00
bootloader: $(payload)
2019-03-04 11:22:19 +04:00
@cargo xbuild $(build_args)
clean:
@cargo clean