-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.golang
57 lines (49 loc) · 1.16 KB
/
Makefile.golang
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
56
57
# Variables for Go commands.
GOBASE := $(shell pwd)
GOBINDIR := "$(GOBASE)/build"
# Allow users to define GOFLAGS, but override it with flags mandatory for
# compilation.
GOFLAGS ?=
ifndef .GOFLAGS_GUARD
.GOFLAGS_GUARD := 1
override GOFLAGS := -mod=vendor $(GOFLAGS)
endif
export GOFLAGS
ifdef DEBUG
$(info GOFLAGS = $(GOFLAGS))
endif
# Allow users to set custom build tags.
GOBUILDTAGS ?=
# Allow users to set custom test timeout.
GOTESTTIMEOUT ?=
# Allow users to run specific tests
GOTESTRUN ?=
# Allow users to set all known build tags by passing ALLTAGS.
ifndef .ALLTAGS_GUARD
.ALLTAGS_GUARD := 1
ifdef ALLTAGS
override GOBUILDTAGS := integration $(GOBUILDTAGS)
endif
endif
GO ?= go
GOBUILD ?= $(GO) build
GOCLEAN ?= $(GO) clean
GOGENERATE ?= $(GO) generate
GOINSTALL ?= $(GO) install
GOMOD ?= $(GO) mod
GORUN ?= $(GO) run
GOTEST ?= $(GO) test
GOTOOL ?= $(GO) tool
ifndef .GOSETUP_GUARD
.GOSETUP_GUARD := 1
ifneq (,$(GOBUILDTAGS))
GOBUILD := $(GOBUILD) -tags='$(GOBUILDTAGS)'
GOTEST := $(GOTEST) -tags='$(GOBUILDTAGS)'
endif
ifneq (,$(GOTESTTIMEOUT))
GOTEST := $(GOTEST) -timeout='$(GOTESTTIMEOUT)'
endif
ifneq (,$(GOTESTRUN))
GOTEST := $(GOTEST) -run='$(GOTESTRUN)'
endif
endif