Makefile OS compatibility update

This commit is contained in:
Greg Szabo 2018-11-07 04:02:18 -05:00
parent c7b3efdd02
commit 02327e13b6
2 changed files with 25 additions and 18 deletions

View File

@ -1,11 +1,9 @@
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
VERSION := $(shell git describe --tags --long | sed 's/v\(.*\)/\1/') VERSION := $(subst v,,$(shell git describe --tags --long))
BUILD_TAGS = netgo ledger BUILD_TAGS = netgo
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}" BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}"
GCC := $(shell command -v gcc 2> /dev/null)
LEDGER_ENABLED ?= true LEDGER_ENABLED ?= true
UNAME_S := $(shell uname -s)
GOTOOLS = \ GOTOOLS = \
github.com/golang/dep/cmd/dep \ github.com/golang/dep/cmd/dep \
github.com/alecthomas/gometalinter \ github.com/alecthomas/gometalinter \
@ -20,23 +18,31 @@ ci: get_tools get_vendor_deps install test_cover test_lint test
######################################## ########################################
### Build/Install ### Build/Install
check-ledger: # Add ledger support - Makefile variable changes are out of a target's scope. There is no point in putting this into a target.
ifeq ($(LEDGER_ENABLED),true) ifeq ($(LEDGER_ENABLED),true)
ifeq ($(UNAME_S),OpenBSD) ifeq ($(OS),Windows_NT)
$(info "OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988)") GCCEXE = $(shell where gcc.exe 2> NUL)
TMP_BUILD_TAGS := $(BUILD_TAGS) ifeq ($(GCCEXE),)
BUILD_TAGS = $(filter-out ledger, $(TMP_BUILD_TAGS)) $(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else else
ifndef GCC BUILD_TAGS += ledger
$(error "gcc not installed for ledger support, please install or set LEDGER_ENABLED to false in the Makefile") endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
BUILD_TAGS += ledger
endif
endif endif
endif endif
else
TMP_BUILD_TAGS := $(BUILD_TAGS)
BUILD_TAGS = $(filter-out ledger, $(TMP_BUILD_TAGS))
endif endif
build: check-ledger update_gaia_lite_docs build:
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
go build $(BUILD_FLAGS) -o build/gaiad.exe ./cmd/gaia/cmd/gaiad go build $(BUILD_FLAGS) -o build/gaiad.exe ./cmd/gaia/cmd/gaiad
go build $(BUILD_FLAGS) -o build/gaiacli.exe ./cmd/gaia/cmd/gaiacli go build $(BUILD_FLAGS) -o build/gaiacli.exe ./cmd/gaia/cmd/gaiacli

View File

@ -41,6 +41,7 @@ IMPROVEMENTS
* Gaia * Gaia
- #2637 [x/gov] Switched inactive and active proposal queues to an iterator based queue - #2637 [x/gov] Switched inactive and active proposal queues to an iterator based queue
- #2672 [Makefile] Updated for better Windows compatibility and ledger support logic
* SDK * SDK
- \#2573 [x/distribution] add accum invariance - \#2573 [x/distribution] add accum invariance