From b0a724ed4734348c1c6cd33f0d801264df9ab28c Mon Sep 17 00:00:00 2001 From: ramin Date: Wed, 13 Mar 2024 11:01:37 +0000 Subject: [PATCH] chore(Makefile): detect and default to make go-install on darwin vs install everywhere else (#3197) refs #3169 Suggestion we add this little detect and switch. One issue i see with attempting to detect GOBIN is that it doesn't HAVE to be set (ie: there can be a default). This i would think is a good quick compromise to un-confuse @rootulp and (potentially) other devs and make this behavior more delightful most of the time. IF not, we should close this and the other issue. --------- Co-authored-by: Rootul P --- Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a43c917345..ddc0b93a6b 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ SHELL=/usr/bin/env bash PROJECTNAME=$(shell basename "$(PWD)") DIR_FULLPATH=$(shell pwd) versioningPath := "github.com/celestiaorg/celestia-node/nodebuilder/node" +OS := $(shell uname -s) LDFLAGS=-ldflags="-X '$(versioningPath).buildTime=$(shell date)' -X '$(versioningPath).lastCommit=$(shell git rev-parse HEAD)' -X '$(versioningPath).semanticVersion=$(shell git describe --tags --dirty=-dev 2>/dev/null || git rev-parse --abbrev-ref HEAD)'" TAGS=integration SHORT= @@ -63,11 +64,19 @@ deps: @go mod download .PHONY: deps -## install: Install all build binaries into the $PREFIX (/usr/local/ by default) directory. +## install: Install the celestia-node binary. install: +ifeq ($(OS),Darwin) + @$(MAKE) go-install +else + @$(MAKE) install-global +endif +.PHONY: install + +install-global: @echo "--> Installing Celestia" @install -v ./build/* -t ${PREFIX}/bin/ -.PHONY: install +.PHONY: install-global ## go-install: Build and install the celestia-node binary into the GOBIN directory. go-install: