diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index f5ec1cfbcba..00f748fe1bf 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -291,7 +291,7 @@ jobs: fi # Check that we don't cross-build uudoc # also do not try to generate manpages for part of hashsum - make install-manpages PREFIX=/tmp/usr UTILS=true RUSTC_ARCH="--target aarch64-unknown-linux-gnu" + env CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu make install-manpages PREFIX=/tmp/usr UTILS=true # build (host) make build echo "Check that target directory will be ignored by backup tools" diff --git a/GNUmakefile b/GNUmakefile index b13dbbd3474..71cb329266f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -25,7 +25,6 @@ endif # Binaries CARGO ?= cargo CARGOFLAGS ?= -RUSTC_ARCH ?= # should be empty except for cross-build, not --target $(shell rustc --print host-tuple) # Install directories PREFIX ?= /usr/local @@ -43,11 +42,12 @@ PROG_PREFIX ?= # This won't support any directory with spaces in its name, but you can just # make a symlink without spaces that points to the directory. +# CARGO_BUILD_TARGET should be undefined for not cross-build. BASEDIR ?= $(shell pwd) ifdef CARGO_TARGET_DIR BUILDDIR := $(CARGO_TARGET_DIR)/${PROFILE} else -BUILDDIR := $(BASEDIR)/target/${PROFILE} +BUILDDIR := $(BASEDIR)/target/$(CARGO_BUILD_TARGET)/${PROFILE} endif PKG_BUILDDIR := $(BUILDDIR)/deps DOCSDIR := $(BASEDIR)/docs @@ -320,14 +320,14 @@ all: build build-pkgs: ifneq (${MULTICALL}, y) ifdef BUILD_SPEC_FEATURE - ${CARGO} build ${CARGOFLAGS} --features "$(BUILD_SPEC_FEATURE)" ${PROFILE_CMD} $(foreach pkg,$(EXES),-p uu_$(pkg)) $(RUSTC_ARCH) + ${CARGO} build ${CARGOFLAGS} --features "$(BUILD_SPEC_FEATURE)" ${PROFILE_CMD} $(foreach pkg,$(EXES),-p uu_$(pkg)) else - ${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} $(foreach pkg,$(EXES),-p uu_$(pkg)) $(RUSTC_ARCH) + ${CARGO} build ${CARGOFLAGS} ${PROFILE_CMD} $(foreach pkg,$(EXES),-p uu_$(pkg)) endif endif build-coreutils: - ${CARGO} build ${CARGOFLAGS} --features "${EXES} $(BUILD_SPEC_FEATURE)" ${PROFILE_CMD} --no-default-features $(RUSTC_ARCH) + ${CARGO} build ${CARGOFLAGS} --features "${EXES} $(BUILD_SPEC_FEATURE)" ${PROFILE_CMD} --no-default-features build: build-coreutils build-pkgs locales @@ -377,21 +377,21 @@ busytest: $(BUILDDIR)/busybox $(addprefix test_busybox_,$(filter-out $(SKIP_UTIL endif clean: - cargo clean $(RUSTC_ARCH) - cd $(DOCSDIR) && $(MAKE) clean $(RUSTC_ARCH) + cargo clean + cd $(DOCSDIR) && $(MAKE) clean distclean: clean - $(CARGO) clean $(CARGOFLAGS) $(RUSTC_ARCH) && $(CARGO) update $(CARGOFLAGS) $(RUSTC_ARCH) + $(CARGO) clean $(CARGOFLAGS) && $(CARGO) update $(CARGOFLAGS) ifeq ($(MANPAGES),y) +# Do not cross-build uudoc build-uudoc: - # Use same PROFILE with coreutils to share crates (if not cross-build) - ${CARGO} build ${CARGOFLAGS} --bin uudoc --features "uudoc ${EXES}" ${PROFILE_CMD} --no-default-features + @unset CARGO_BUILD_TARGET && ${CARGO} build ${CARGOFLAGS} --bin uudoc --features "uudoc ${EXES}" ${PROFILE_CMD} --no-default-features install-manpages: build-uudoc mkdir -p $(DESTDIR)$(DATAROOTDIR)/man/man1 $(foreach prog, $(INSTALLEES) $(HASHSUM_PROGS), \ - $(BUILDDIR)/uudoc manpage $(prog) > $(DESTDIR)$(DATAROOTDIR)/man/man1/$(PROG_PREFIX)$(prog).1 $(newline) \ + $(BASEDIR)/target/$(PROFILE)/uudoc manpage $(prog) > $(DESTDIR)$(DATAROOTDIR)/man/man1/$(PROG_PREFIX)$(prog).1 $(newline) \ ) else install-manpages: @@ -404,9 +404,9 @@ install-completions: build-uudoc mkdir -p $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions mkdir -p $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d $(foreach prog, $(INSTALLEES) $(HASHSUM_PROGS) , \ - $(BUILDDIR)/uudoc completion $(prog) zsh > $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/_$(PROG_PREFIX)$(prog) $(newline) \ - $(BUILDDIR)/uudoc completion $(prog) bash > $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/$(PROG_PREFIX)$(prog).bash $(newline) \ - $(BUILDDIR)/uudoc completion $(prog) fish > $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/$(PROG_PREFIX)$(prog).fish $(newline) \ + $(BASEDIR)/target/$(PROFILE)/uudoc completion $(prog) zsh > $(DESTDIR)$(DATAROOTDIR)/zsh/site-functions/_$(PROG_PREFIX)$(prog) $(newline) \ + $(BASEDIR)/target/$(PROFILE)/uudoc completion $(prog) bash > $(DESTDIR)$(DATAROOTDIR)/bash-completion/completions/$(PROG_PREFIX)$(prog).bash $(newline) \ + $(BASEDIR)/target/$(PROFILE)/uudoc completion $(prog) fish > $(DESTDIR)$(DATAROOTDIR)/fish/vendor_completions.d/$(PROG_PREFIX)$(prog).fish $(newline) \ ) else install-completions: