From 7c36caa6d9f54fd9ec58cd770f64e19e17fc740a Mon Sep 17 00:00:00 2001 From: mattthew Date: Mon, 13 Jan 2025 16:15:08 -0500 Subject: [PATCH] Set the install target correctly when cross-compiling --- dgraph/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dgraph/Makefile b/dgraph/Makefile index ad535691d58..9e486d96a49 100644 --- a/dgraph/Makefile +++ b/dgraph/Makefile @@ -29,6 +29,7 @@ BUILD_VERSION := $(shell echo ${DGRAPH_VERSION} | sed -e 's/-amd64//' -e 's/-arm endif GOOS ?= $(shell go env GOOS) +GOARCH ?= $(shell go env GOARCH) # Only build with jemalloc on Linux, mac ifeq ($(GOOS),$(filter $(GOOS),linux darwin)) BUILD_TAGS ?= jemalloc @@ -72,6 +73,9 @@ INSTALL_TARGET = $(GOPATH)/bin/$(BIN) ifneq ($(strip $(shell go env GOBIN)),) INSTALL_TARGET = $(shell go env GOBIN)/$(BIN) endif +ifneq ($(GOOS)_$(GOARCH),$(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)) + INSTALL_TARGET = $(GOPATH)/bin/$(GOOS)_$(GOARCH)/$(BIN) +endif .PHONY: all $(BIN) all: $(BIN)