63 lines
1.9 KiB
Makefile
63 lines
1.9 KiB
Makefile
# Copyright 2020 PingCAP, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
##################################
|
|
# Set this values for each project
|
|
|
|
PROJECT := qfixpt
|
|
DOMAIN := quantex.com
|
|
|
|
##################################
|
|
|
|
ISSUE_PREFIX := QPT
|
|
GOPATH ?= $(shell go env GOPATH)
|
|
|
|
P=8
|
|
|
|
GIT_TREE_STATE=$(shell (git status --porcelain | grep -q .) && echo dirty || echo clean)
|
|
|
|
# Ensure GOPATH is set before running build process.
|
|
ifeq "$(GOPATH)" ""
|
|
$(error Please set the environment variable GOPATH before running `make`)
|
|
endif
|
|
FAIL_ON_STDOUT := awk '{ print } END { if (NR > 0) { exit 1 } }'
|
|
|
|
CURDIR := $(shell pwd)
|
|
path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH))):$(PWD)/tools/bin
|
|
export PATH := $(path_to_add):$(PATH)
|
|
|
|
GOBUILD := go build $(BUILD_FLAG) -tags codes
|
|
GOBUILDCOVERAGE := GOPATH=$(GOPATH) cd tidb-server; $(GO) test -coverpkg="../..." -c .
|
|
GOTEST := go test -p $(P)
|
|
|
|
LINUX := "Linux"
|
|
MAC := "Darwin"
|
|
# PACKAGE_LIST := go list ./...| grep -vE "cmd|$(DOMAIN)\/$(PROJECT)\/tests"
|
|
PACKAGE_LIST := go list ./...| grep -vE "$(DOMAIN)\/$(PROJECT)\/tests"
|
|
PACKAGES ?= $$($(PACKAGE_LIST))
|
|
PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|$(DOMAIN)/$(PROJECT)/||' | sed 's|$(DOMAIN)/$(PROJECT)||'
|
|
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
|
|
|
|
DEFAULT_OUT_PATH := "./build/out/distribution"
|
|
|
|
RACE_FLAG =
|
|
ifeq ("$(WITH_RACE)", "1")
|
|
RACE_FLAG = -race
|
|
GOBUILD = GOPATH=$(GOPATH) $(GO) build
|
|
endif
|
|
|
|
CHECK_FLAG =
|
|
ifeq ("$(WITH_CHECK)", "1")
|
|
CHECK_FLAG = $(TEST_LDFLAGS)
|
|
endif
|