-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.def
55 lines (40 loc) · 1.48 KB
/
Makefile.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#============== image configuration
# Registry configuration
REGISTRY ?= ghcr.io/spidernet-io
# Image names
CONTROLLER_IMAGE_NAME = bmc-controller
AGENT_IMAGE_NAME = bmc-agent
TOOLS_IMAGE_NAME = bmc-tools
# Image tags
VERSION ?= $(shell git rev-parse --short HEAD)
TOOLS_IMAGE_TAG ?= latest
# Full image paths
CONTROLLER_IMAGE = $(REGISTRY)/$(CONTROLLER_IMAGE_NAME)
AGENT_IMAGE = $(REGISTRY)/$(AGENT_IMAGE_NAME)
TOOLS_IMAGE = $(REGISTRY)/$(TOOLS_IMAGE_NAME)
# Full image references with tags
CONTROLLER_IMAGE_REF = $(CONTROLLER_IMAGE):$(VERSION)
AGENT_IMAGE_REF = $(AGENT_IMAGE):$(VERSION)
TOOLS_IMAGE_REF = $(TOOLS_IMAGE):$(TOOLS_IMAGE_TAG)
#===================
# Output directory
BIN_DIR := bin
# Go build configuration
GOOS ?= linux
GOARCH ?= amd64
CGO_ENABLED ?= 0
GO_BUILD_ENV ?= CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) GOARCH=$(GOARCH)
GO_BUILD_FLAGS += -mod=vendor
ifeq ($(DISABLE_RACE),)
GO_BUILD_FLAGS += -race
GO_BUILD_ENV += CGO_ENABLED=1
endif
ifeq ($(DISABLE_LOCKDEBUG),)
GO_BUILD_FLAGS += -tags=lockdebug
endif
GO_BUILD = $(GO_BUILD_ENV) go build $(GO_BUILD_FLAGS)
#=============== image environment variables
PROJECT_VERSION = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION)
GIT_COMMIT_VERSION = $(shell git show -s --format='format:%H')
GIT_COMMIT_TIME = $(shell git show -s --format='format:%aI')
DOCKER_BUILD_FLAGS := --build-arg GIT_COMMIT_VERSION=$(GIT_COMMIT_VERSION) --build-arg GIT_COMMIT_TIME=$(GIT_COMMIT_TIME) --build-arg PROJECT_VERSION=$(PROJECT_VERSION)