forked from elastic/apm-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
go.make
61 lines (47 loc) · 2.2 KB
/
go.make
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
58
59
60
61
GITROOT ?= $(shell git rev-parse --show-toplevel)
# Ensure the Go version in .go_version is installed and used.
GOROOT?=$(shell $(GITROOT)/script/run_with_go_ver go env GOROOT)
GO:=$(GOROOT)/bin/go
export PATH:=$(GOROOT)/bin:$(PATH)
GOOSBUILD:=$(GITROOT)/build/$(shell $(GO) env GOOS)
APPROVALS=$(GOOSBUILD)/approvals
GENPACKAGE=$(GOOSBUILD)/genpackage
GOIMPORTS=$(GOOSBUILD)/goimports
GOLICENSER=$(GOOSBUILD)/go-licenser
GOLINT=$(GOOSBUILD)/golint
MAGE=$(GOOSBUILD)/mage
REVIEWDOG=$(GOOSBUILD)/reviewdog
STATICCHECK=$(GOOSBUILD)/staticcheck
ELASTICPACKAGE=$(GOOSBUILD)/elastic-package
TERRAFORMDOCS=$(GOOSBUILD)/terraform-docs
GOBENCH=$(GOOSBUILD)/gobench
APM_SERVER_VERSION=$(shell grep defaultBeatVersion $(GITROOT)/cmd/version.go | cut -d'=' -f2 | tr -d '" ')
##############################################################################
# Rules for creating and installing build tools.
##############################################################################
BIN_MAGE=$(GOOSBUILD)/bin/mage
# BIN_MAGE is the standard "mage" binary.
$(BIN_MAGE): $(GITROOT)/go.mod
$(GO) build -o $@ github.com/magefile/mage
# MAGE is the compiled magefile.
$(MAGE): $(GITROOT)/magefile.go $(BIN_MAGE)
$(BIN_MAGE) -compile=$@
$(GOLINT): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< golang.org/x/lint/golint
$(GOIMPORTS): $(GITROOT)/go.mod
$(GO) build -o $@ golang.org/x/tools/cmd/goimports
$(STATICCHECK): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< honnef.co/go/tools/cmd/staticcheck
$(GOLICENSER): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< github.com/elastic/go-licenser
$(REVIEWDOG): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< github.com/reviewdog/reviewdog/cmd/reviewdog
$(ELASTICPACKAGE): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< -ldflags '-X github.com/elastic/elastic-package/internal/version.CommitHash=anything' github.com/elastic/elastic-package
$(TERRAFORMDOCS): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< github.com/terraform-docs/terraform-docs
$(GOBENCH): $(GITROOT)/tools/go.mod
$(GO) build -o $@ -modfile=$< github.com/elastic/gobench
.PHONY: $(APPROVALS)
$(APPROVALS):
@$(GO) build -o $@ github.com/elastic/apm-server/approvaltest/cmd/check-approvals