src/include/mk/hhl.cargo.mk

40 lines
894 B
Makefile

# hhl.cargo.mk
# Copyright 2023 Nathan Fisher <nfisher.sr@gmail.com>
#
include world.mk
include hhl.doc.mk
include hhl.locale.mk
include hhl.colors.mk
ifeq ($(arch), riscv64)
rust_tgt = riscv64gc-unknown-linux-musl
CARGO = cargo +nightly
BUILD_STD = -Zbuild-std=std,panic_abort
else
rust_tgt = $(arch)-unknown-linux-musl
CARGO = cargo
endif
tgt_dir = $(global_objdir)/$(progname)/target
export CARGO_TARGET_DIR = $(tgt_dir)
cargo_out = $(patsubst %,$(tgt_dir)/$(rust_tgt)/release/%,$(bins))
install: $(cargo_out) $(docs) $(locales) | $(bindir)
install $(perms) $(cargo_out) $(bindir)/
$(info $(grn)=== Finished building $(progname) ===$(reset))
$(bindir):
install -d $@
$(cargo_out):
$(info $(grn)=== Building for ${progname} ===$(reset))
${pre_build}
$(CARGO) build $(BUILD_STD) --target=$(rust_tgt) --release
${post_build}
clean:
cargo clean
.PHONY: install clean