Skip to content

Commit

Permalink
Set the install target correctly when cross-compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmcneely committed Jan 13, 2025
1 parent 15839b1 commit 7c36caa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dgraph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7c36caa

Please sign in to comment.