SHELL := /bin/bash # include the common make file COMMON_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) # root dir ifeq ($(origin ROOT_DIR),undefined) ROOT_DIR := $(abspath $(shell cd $(COMMON_SELF_DIR)/../.. && pwd -P)) endif # output dir ifeq ($(origin OUTPUT_DIR),undefined) OUTPUT_DIR := $(ROOT_DIR)/_output $(shell mkdir -p $(OUTPUT_DIR)) endif # ifeq ($(origin TOOLS_DIR),undefined) # TOOLS_DIR := $(OUTPUT_DIR)/tools # $(shell mkdir -p $(TOOLS_DIR)) # endif # ifeq ($(origin TMP_DIR),undefined) # TMP_DIR := $(OUTPUT_DIR)/tmp # $(shell mkdir -p $(TMP_DIR)) # endif # web root ifeq ($(origin WEB_ROOT_DIR),undefined) WEB_ROOT_DIR := $(ROOT_DIR)/web endif # cubejs root ifeq ($(origin CUBE_ROOT_DIR),undefined) CUBE_ROOT_DIR := $(ROOT_DIR)/cube endif # set the version number. you should not need to do this # for the majority of scenarios ifeq ($(origin VERSION), undefined) VERSION := $(shell git describe --tags --always --match='v*') endif # Check if the tree is dirty. default to dirty GIT_TREE_STATE:="dirty" ifeq (, $(shell git status --porcelain 2>/dev/null)) GIT_TREE_STATE="clean" endif GIT_COMMIT:=$(shell git rev-parse HEAD) GIT_COMMIT_SHORT:=$(shell git rev-parse --short=8 HEAD) # Minimum test coverage ifeq ($(origin COVERAGE),undefined) COVERAGE := 60 endif # The OS must be linux when building docker images PLATFORMS ?= linux_amd64 linux_arm64 # The OS can be linux/windows/darwin when building binaries # PLATFORMS ?= darwin_amd64 windows_amd64 linux_amd64 linux_arm64 # Set a specific PLATFORM ifeq ($(origin PLATFORM), undefined) ifeq ($(origin GOOS), undefined) GOOS := $(shell go env GOOS) endif ifeq ($(origin GOARCH), undefined) GOARCH := $(shell go env GOARCH) endif PLATFORM := $(GOOS)_$(GOARCH) # Use linux as the default OS when building images IMAGE_PLAT := linux_$(GOARCH) else GOOS := $(word 1, $(subst _, ,$(PLATFORM))) GOARCH := $(word 2, $(subst _, ,$(PLATFORM))) IMAGE_PLAT := $(PLATFORM) endif # Linux command settings FIND := find . ! -path './third_party/*' ! -path './vendor/*' XARGS := xargs --no-run-if-empty # Makefile settings ifndef V MAKEFLAGS += --no-print-directory endif # Specify tools severity, include: BLOCKER_TOOLS, CRITICAL_TOOLS, TRIVIAL_TOOLS. # Missing BLOCKER_TOOLS can cause the CI flow execution failed, i.e. `make all` failed. # Missing CRITICAL_TOOLS can lead to some necessary operations failed. i.e. `make release` failed. # TRIVIAL_TOOLS are Optional tools, missing these tool have no affect. BLOCKER_TOOLS ?= gsemver golines go-junit-report golangci-lint addlicense goimports codegen CRITICAL_TOOLS ?= swagger mockgen gotests git-chglog github-release coscmd go-mod-outdated protoc-gen-go cfssl TRIVIAL_TOOLS ?= depth go-callvis gothanks richgo rts kube-score COMMA := , SPACE := SPACE +=