SHELL := /bin/bash # include the init make file INIT_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(origin ROOT_DIR),undefined) ROOT_DIR := $(abspath $(shell cd $(INIT_SELF_DIR)/../.. && pwd -P)) endif ifeq ($(origin OUTPUT_DIR),undefined) OUTPUT_DIR := $(ROOT_DIR)/_output $(shell mkdir -p $(OUTPUT_DIR)) endif ifeq ($(origin TMP_DIR),undefined) TMP_DIR := $(OUTPUT_DIR)/tmp $(shell mkdir -p $(TMP_DIR)) 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) # The OS can be linux/darwin when building binaries PLATFORMS ?= linux_amd64 # 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) IMAGE_PLAT := linux_$(GOARCH) else GOOS := $(word 1, $(subst _, ,$(PLATFORM))) GOARCH := $(word 2, $(subst _, ,$(PLATFORM))) IMAGE_PLAT := $(PLATFORM) endif # Linux(GNU) command settings FIND := find . ! -path './third_party/*' ! -path './vendor/*' XARGS := xargs --no-run-if-empty # Makefile settings ifndef V MAKEFLAGS += --no-print-directory endif GO := go Docker := docker DOCKER_REG := asia-east2-docker.pkg.dev/gcp-digital-infra/internal-tools # Copy githook scripts when execute makefile #COPY_GITHOOK:=$(shell cp -f githooks/* .git/hooks/) # 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 ?= go-gitlint golangci-lint goimports gofumpt CRITICAL_TOOLS ?= TRIVIAL_TOOLS ?= COMMA := , SPACE := SPACE +=