Skip to content

Commit

Permalink
chore(Makefile): detect and default to make go-install on darwin vs i…
Browse files Browse the repository at this point in the history
…nstall everywhere else (#3197)

<!--
Thank you for submitting a pull request!

Please make sure you have reviewed our contributors guide before
submitting your
first PR.

Please ensure you've addressed or included references to any related
issues.

Tips:
- Use keywords like "closes" or "fixes" followed by an issue number to
automatically close related issues when the PR is merged (e.g., "closes
#123" or "fixes #123").
- Describe the changes made in the PR.
- Ensure the PR has one of the required tags (kind:fix, kind:misc,
kind:break!, kind:refactor, kind:feat, kind:deps, kind:docs, kind:ci,
kind:chore, kind:testing)

-->

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 <rootulp@gmail.com>
  • Loading branch information
ramin and rootulp committed Mar 13, 2024
1 parent e902680 commit b0a724e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b0a724e

Please sign in to comment.