Skip to content

Commit

Permalink
Merge branch 'develop' into fix/remove_i_buildflag
Browse files Browse the repository at this point in the history
  • Loading branch information
jdknives committed Feb 28, 2021
2 parents 4b1baa0 + e209fe2 commit 2a1ee87
Show file tree
Hide file tree
Showing 26 changed files with 501 additions and 1,281 deletions.
239 changes: 120 additions & 119 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,119 +1,120 @@
export GO111MODULE=on

.DEFAULT_GOAL := help
.PHONY: build-parser build build-full test test-full
.PHONY: install-deps install install-full
.PHONY: dep

PWD := $(shell pwd)

UNAME_S := $(shell uname -s)

CXVERSION := $(shell $(PWD)/bin/cx --version 2> /dev/null)

ifneq (,$(findstring Linux, $(UNAME_S)))
PLATFORM := LINUX
SUBSYSTEM := LINUX
PACKAGES := PGK_NAMES_LINUX
DISPLAY := :99.0
endif

ifneq (,$(findstring Darwin, $(UNAME_S)))
PLATFORM := MACOS
SUBSYSTEM := MACOS
PACKAGES := PKG_NAMES_MACOS
endif

ifneq (,$(findstring MINGW, $(UNAME_S)))
PLATFORM := WINDOWS
SUBSYSTEM := MINGW
PACKAGES := PKG_NAMES_WINDOWS
endif

ifneq (,$(findstring MSYS, $(UNAME_S)))
PLATFORM := WINDOWS
SUBSYSTEM := MSYS
PACKAGES := PKG_NAMES_WINDOWS
endif

ifeq ($(PLATFORM), WINDOWS)
GOPATH := $(subst \,/,${GOPATH})
HOME := $(subst \,/,${HOME})
CXPATH := $(subst, \,/, ${CXPATH})
endif

GLOBAL_GOPATH := $(GOPATH)
LOCAL_GOPATH := $(HOME)/go

ifdef GLOBAL_GOPATH
GOPATH := $(GLOBAL_GOPATH)
else
GOPATH := $(LOCAL_GOPATH)
endif

GOLANGCI_LINT_VERSION ?= latest

GO_OPTS ?= -mod=vendor

ifdef CXPATH
CX_PATH := $(CXPATH)
else
CX_PATH := $(HOME)/cx
endif

ifeq ($(UNAME_S), Linux)
endif

build: ## Build CX from sources
go build $(GO_OPTS) -tags="base" -o ./bin/cx github.com/skycoin/cx/cxgo/
chmod +x ./bin/cx

clean: ## Removes binaries.
rm -r ./bin/cx

build-full: install-full ## Build CX from sources with all build tags
go build $(GO_OPTS) -tags="base cxfx" -o ./bin/cx github.com/skycoin/cx/cxgo/
chmod +x ./bin/cx

token-fuzzer:
go build $(GO_OPTS) -o ./bin/cx-token-fuzzer $(PWD)/development/token-fuzzer/main.go
chmod +x ${GOPATH}/bin/cx-token-fuzzer

build-parser: install-deps ## Generate lexer and parser for CX grammar
./bin/goyacc -o cxgo/cxgo0/cxgo0.go cxgo/cxgo0/cxgo0.y
./bin/goyacc -o cxgo/parser/cxgo.go cxgo/parser/cxgo.y

install: install-deps build configure-workspace ## Install CX from sources. Build dependencies
@echo 'NOTE:\tWe recommend you to test your CX installation by running "cx ./tests"'
./bin/cx -v

install-full: configure-workspace

test: ## Run CX test suite.
ifndef CXVERSION
@echo "cx not found in $(PWD)/bin, please run make install first"
else
# go test $(GO_OPTS) -race -tags base github.com/skycoin/cx/cxgo/
./bin/cx ./lib/args.cx ./tests/main.cx ++wdir=./tests ++disable-tests=gui,issue
endif

test-full: build ## Run CX test suite with all build tags
# go test $(GO_OPTS) -race -tags="base cxfx" github.com/skycoin/cx/cxgo/
./bin/cx ./lib/args.cx ./tests/main.cx ++wdir=./tests ++disable-tests=gui,issue

configure-workspace: ## Configure CX workspace environment
mkdir -p $(CX_PATH)/src $(CX_PATH)/bin $(CX_PATH)/pkg
@echo "NOTE:\tCX workspace at $(CX_PATH)"

format: ## Formats the code. Must have goimports installed (use make install-linters).
goimports -w -local github.com/skycoin/cx ./cx
goimports -w -local github.com/skycoin/cx ./cxfx
goimports -w -local github.com/skycoin/cx ./cxgo

dep: ## Update go vendor
go mod $(GO_OPTS) vendor
go mod $(GO_OPTS) verify
go mod $(GO_OPTS) tidy

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
export GO111MODULE=on

.DEFAULT_GOAL := help
.PHONY: build-parser build build-full test test-full
.PHONY: install-deps install install-full
.PHONY: dep

PWD := $(shell pwd)

UNAME_S := $(shell uname -s)

CXVERSION := $(shell $(PWD)/bin/cx --version 2> /dev/null)

ifneq (,$(findstring Linux, $(UNAME_S)))
PLATFORM := LINUX
SUBSYSTEM := LINUX
PACKAGES := PGK_NAMES_LINUX
DISPLAY := :99.0
endif

ifneq (,$(findstring Darwin, $(UNAME_S)))
PLATFORM := MACOS
SUBSYSTEM := MACOS
PACKAGES := PKG_NAMES_MACOS
endif

ifneq (,$(findstring MINGW, $(UNAME_S)))
PLATFORM := WINDOWS
SUBSYSTEM := MINGW
PACKAGES := PKG_NAMES_WINDOWS
endif

ifneq (,$(findstring MSYS, $(UNAME_S)))
PLATFORM := WINDOWS
SUBSYSTEM := MSYS
PACKAGES := PKG_NAMES_WINDOWS
endif

ifeq ($(PLATFORM), WINDOWS)
GOPATH := $(subst \,/,${GOPATH})
HOME := $(subst \,/,${HOME})
CXPATH := $(subst, \,/, ${CXPATH})
endif

GLOBAL_GOPATH := $(GOPATH)
LOCAL_GOPATH := $(HOME)/go

ifdef GLOBAL_GOPATH
GOPATH := $(GLOBAL_GOPATH)
else
GOPATH := $(LOCAL_GOPATH)
endif

GOLANGCI_LINT_VERSION ?= latest

GO_OPTS ?= -mod=vendor

ifdef CXPATH
CX_PATH := $(CXPATH)
else
CX_PATH := $(HOME)/cx
endif

ifeq ($(UNAME_S), Linux)
endif

build: ## Build CX from sources
go build $(GO_OPTS) -tags="base" -o ./bin/cx github.com/skycoin/cx/cxgo/
chmod +x ./bin/cx

clean: ## Removes binaries.
rm -r ./bin/cx

build-full: install-full ## Build CX from sources with all build tags
go build $(GO_OPTS) -tags="base cxfx" -o ./bin/cx github.com/skycoin/cx/cxgo/
chmod +x ./bin/cx

token-fuzzer:
go build $(GO_OPTS) -o ./bin/cx-token-fuzzer $(PWD)/development/token-fuzzer/main.go
chmod +x ${GOPATH}/bin/cx-token-fuzzer

build-parser: install-deps ## Generate lexer and parser for CX grammar
./bin/goyacc -o cxgo/cxgo0/cxgo0.go cxgo/cxgo0/cxgo0.y
./bin/goyacc -o cxgo/parser/cxgo.go cxgo/parser/cxgo.y

install: install-deps build configure-workspace ## Install CX from sources. Build dependencies
@echo 'NOTE:\tWe recommend you to test your CX installation by running "cx ./tests"'
./bin/cx -v

install-full: configure-workspace

test: ## Run CX test suite.
ifndef CXVERSION
@echo "cx not found in $(PWD)/bin, please run make install first"
else
# go test $(GO_OPTS) -race -tags base github.com/skycoin/cx/cxgo/
./bin/cx ./lib/args.cx ./tests/main.cx ++wdir=./tests ++disable-tests=gui,issue
endif

test-full: build ## Run CX test suite with all build tags
# go test $(GO_OPTS) -race -tags="base cxfx" github.com/skycoin/cx/cxgo/
./bin/cx ./lib/args.cx ./tests/main.cx ++wdir=./tests ++disable-tests=gui,issue

configure-workspace: ## Configure CX workspace environment
mkdir -p $(CX_PATH)/src $(CX_PATH)/bin $(CX_PATH)/pkg
@echo "NOTE:\tCX workspace at $(CX_PATH)"

format: ## Formats the code. Must have goimports installed (use make install-linters).
goimports -w -local github.com/skycoin/cx ./cmd
goimports -w -local github.com/skycoin/cx ./cx
goimports -w -local github.com/skycoin/cx ./cxfx
goimports -w -local github.com/skycoin/cx ./cxgo

dep: ## Update go vendor
go mod $(GO_OPTS) vendor
go mod $(GO_OPTS) verify
go mod $(GO_OPTS) tidy

help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ cx-setup.bat
Test your installation by running:

```
cx tests\main.cx ++wdir=tests ++disable-tests=issue
cx lib/args.cx tests/main.cx ++wdir=tests ++disable-tests=issue
```

## Updating CX
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2a1ee87

Please sign in to comment.