build: Simplify cargo target replacement.

This commit is contained in:
Rémi Bernon 2021-11-05 23:40:19 +01:00 committed by Arkadiusz Hiler
parent 808b99bd27
commit 09568c2159
2 changed files with 5 additions and 2 deletions

View File

@ -14,9 +14,12 @@ $$(OBJ)/.$(1)-configure$(3):
$$(OBJ)/.$(1)-build$(3):
@echo ":: building $(3)bit $(1)..." >&2
cd $$($(2)_SRC) && env $$($(2)_ENV$(3)) \
cargo build $$(filter -j%,$$(MAKEFLAGS)) --target "$$(ARCH$(3))-unknown-linux-gnu" --target-dir $$($(2)_OBJ$(3)) $$(CARGO_BUILD_ARG)
cargo build $$(filter -j%,$$(MAKEFLAGS)) --target "$$(CARGO_TARGET_$(3))" --target-dir $$($(2)_OBJ$(3)) $$(CARGO_BUILD_ARG)
touch $$@
endif
endef
rules-cargo = $(call create-rules-cargo,$(1),$(call toupper,$(1)),$(2))
CARGO_TARGET_32 := i686-unknown-linux-gnu
CARGO_TARGET_64 := x86_64-unknown-linux-gnu

View File

@ -109,7 +109,7 @@ CONTAINERGOALS := $(CONTAINERGOALS) $(filter $(1),$(MAKECMDGOALS))
$(2)_ENV$(3) = \
CARGO_HOME=$$(OBJ)/.cargo \
CARGO_TARGET_$$(call toupper,$$(ARCH$(3))-unknown-linux-gnu)_LINKER="$$(ARCH$(3))-linux-gnu-gcc" \
CARGO_TARGET_$$(call toupper,$$(CARGO_TARGET_$(3)))_LINKER="$$(ARCH$(3))-linux-gnu-gcc" \
CCACHE_BASEDIR="$$(CCACHE_BASEDIR)" \
STRIP="$$(STRIP)" \
CC="$$(CCACHE_BIN) $$(ARCH$(3))-linux-gnu-gcc" \