Use the native ARCH only incase it is not set, this will allow the cross complilation where ARCH is explicitly set. Add few info prints as well to know what arch and toolchain is getting used to build it. Additionally, simplify the check for ARCH so that fcopy daemon is build only for x86_64. Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver") Reported-by: Adrian Vladu <avladu@xxxxxxxxxxxxxxxxxxxxxx> Closes: https://lore.kernel.org/linux-hyperv/Z1Y9ZkAt9GPjQsGi@liuwe-devbox-debian-v2/ Signed-off-by: Saurabh Sengar <ssengar@xxxxxxxxxxxxxxxxxxx> --- tools/hv/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/hv/Makefile b/tools/hv/Makefile index 34ffcec264ab..d29e6be6309b 100644 --- a/tools/hv/Makefile +++ b/tools/hv/Makefile @@ -2,7 +2,7 @@ # Makefile for Hyper-V tools include ../scripts/Makefile.include -ARCH := $(shell uname -m 2>/dev/null) +ARCH ?= $(shell uname -m 2>/dev/null) sbindir ?= /usr/sbin libexecdir ?= /usr/libexec sharedstatedir ?= /var/lib @@ -20,18 +20,26 @@ override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include override CFLAGS += -Wno-address-of-packed-member ALL_TARGETS := hv_kvp_daemon hv_vss_daemon -ifneq ($(ARCH), aarch64) +ifeq ($(ARCH), x86_64) ALL_TARGETS += hv_fcopy_uio_daemon endif ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) ALL_SCRIPTS := hv_get_dhcp_info.sh hv_get_dns_info.sh hv_set_ifconfig.sh -all: $(ALL_PROGRAMS) +all: info $(ALL_PROGRAMS) export srctree OUTPUT CC LD CFLAGS include $(srctree)/tools/build/Makefile.include +info: + @echo "---------------------" + @echo "Building for:" + @echo "CC $(CC)" + @echo "LD $(LD)" + @echo "ARCH $(ARCH)" + @echo "---------------------" + HV_KVP_DAEMON_IN := $(OUTPUT)hv_kvp_daemon-in.o $(HV_KVP_DAEMON_IN): FORCE $(Q)$(MAKE) $(build)=hv_kvp_daemon -- 2.43.0