github.com/iotexproject/iotex-core@v1.14.1-rc1/tools/bot/Makefile (about) 1 ######################################################################################################################## 2 # Copyright (c) 2019 IoTeX Foundation 3 # This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability 4 # or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed. 5 # This source code is governed by Apache License 2.0 that can be found in the LICENSE file. 6 ######################################################################################################################## 7 8 # Go parameters 9 GOCMD=go 10 GOVET=$(GOCMD) vet 11 GOBUILD=$(GOCMD) build 12 GOINSTALL=$(GOCMD) install 13 GOCLEAN=$(GOCMD) clean 14 GOTEST=$(GOCMD) test 15 GOGET=$(GOCMD) get 16 BUILD_TARGET_SERVER=bot 17 BUILD_SRC=server 18 19 # Pkgs 20 ALL_PKGS := $(shell go list ./... ) 21 PKGS := $(shell go list ./... | grep -v /test/ ) 22 ROOT_PKG := "github.com/iotexproject/iotex-core/tools/bot" 23 24 # Package Info 25 PACKAGE_VERSION := $(shell git describe --always) 26 PACKAGE_COMMIT_ID := $(shell git rev-parse HEAD) 27 GIT_STATUS := $(shell git status --porcelain) 28 ifdef GIT_STATUS 29 GIT_STATUS := "dirty" 30 else 31 GIT_STATUS := "clean" 32 endif 33 GO_VERSION := $(shell go version) 34 BUILD_TIME=$(shell date +%F-%Z/%T) 35 VersionImportPath := github.com/iotexproject/iotex-core/pkg/version 36 PackageFlags += -X '$(VersionImportPath).PackageVersion=$(PACKAGE_VERSION)' 37 PackageFlags += -X '$(VersionImportPath).PackageCommitID=$(PACKAGE_COMMIT_ID)' 38 PackageFlags += -X '$(VersionImportPath).GitStatus=$(GIT_STATUS)' 39 PackageFlags += -X '$(VersionImportPath).GoVersion=$(GO_VERSION)' 40 PackageFlags += -X '$(VersionImportPath).BuildTime=$(BUILD_TIME)' 41 PackageFlags += -s -w 42 43 TEST_IGNORE= ".git,vendor" 44 COV_OUT := profile.coverprofile 45 COV_REPORT := overalls.coverprofile 46 COV_HTML := coverage.html 47 48 LINT_LOG := lint.log 49 50 V ?= 0 51 ifeq ($(V),0) 52 ECHO_V = @ 53 else 54 VERBOSITY_FLAG = -v 55 DEBUG_FLAG = -debug 56 endif 57 58 all: clean build 59 60 .PHONY: build 61 build: 62 $(GOBUILD) -ldflags "$(PackageFlags)" -o ./$(BUILD_TARGET_SERVER) -v ./$(BUILD_SRC) 63 64 .PHONY: license 65 license: 66 @./misc/scripts/licenseheader.sh 67 68 69 .PHONY: clean 70 clean: 71 @echo "Cleaning..." 72 $(ECHO_V)rm -rf ./$(BUILD_TARGET_SERVER)