-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
105 lines (83 loc) · 2.99 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
CLYMENE_IMPORT_PATH=github.com/Clymene-project/Clymene
include docker/Makefile
# all .go files that are not auto-generated and should be auto-formatted and linted.
ALL_SRC := $(shell find . -name '*.go' \
-not -name 'doc.go' \
-not -name '_*' \
-not -name '.*' \
-not -name 'model.pb.go' \
-not -path './examples/*' \
-not -path './vendor/*' \
-not -path '*/mocks/*' \
-type f | \
sort)
# ALL_PKGS is used with 'golint'
ALL_PKGS := $(shell echo $(dir $(ALL_SRC)) | tr ' ' '\n' | sort -u)
UNAME := $(shell uname -m)
#Race flag is not supported on s390x architecture
ifeq ($(UNAME), s390x)
RACE=
else
RACE=-race
endif
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOBUILD=CGO_ENABLED=0 installsuffix=cgo go build -trimpath
GOTEST=go test -v $(RACE)
GOLINT=golint
GOVET=go vet
GOFMT=gofmt
FMT_LOG=.fmt.log
LINT_LOG=.lint.log
IMPORT_LOG=.import.log
GIT_SHA=$(shell git rev-parse HEAD)
GIT_BRANCH=$(shell git branch)
DATE=$(shell date -u '%Y-%m-%dT%H:%M:%SZ')
BUILD_INFO=-ldflags "-X 'main.Version=$(GIT_BRANCH)($(GIT_SHA))' -X 'main.BuildTime=$(DATE)'"
.PHONY: build-agent
build-agent :
$(GOBUILD) -o ./out/clymene-agent-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/agent/main.go
.PHONY: build-ingester
build-ingester :
$(GOBUILD) -o ./out/clymene-ingester-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/ingester/main.go
.PHONY: build-gateway
build-gateway :
$(GOBUILD) -o ./out/clymene-gateway-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/gateway/main.go
.PHONY: build-promtail
build-promtail :
$(GOBUILD) -o ./out/clymene-promtail-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/promtail/main.go
.PHONY: build-promtail-ingester
build-promtail-ingester :
$(GOBUILD) -o ./out/promtail-ingester-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/promtail-ingester/main.go
.PHONY: build-promtail-gateway
build-promtail-gateway :
$(GOBUILD) -o ./out/promtail-gateway-$(GOOS)-$(GOARCH) $(BUILD_INFO) ./cmd/promtail-gateway/main.go
.PHONY: docker
docker: build-binaries-linux docker-images-only
.PHONY: build-binaries-linux
build-binaries-linux:
GOOS=linux GOARCH=amd64 $(MAKE) build-platform-binaries
.PHONY: build-binaries-windows
build-binaries-windows:
GOOS=windows GOARCH=amd64 $(MAKE) build-platform-binaries
.PHONY: build-binaries-darwin
build-binaries-darwin:
GOOS=darwin GOARCH=amd64 $(MAKE) build-platform-binaries
.PHONY: build-binaries-s390x
build-binaries-s390x:
GOOS=linux GOARCH=s390x $(MAKE) build-platform-binaries
.PHONY: build-binaries-arm64
build-binaries-arm64:
GOOS=linux GOARCH=arm64 $(MAKE) build-platform-binaries
.PHONY: build-binaries-ppc64le
build-binaries-ppc64le:
GOOS=linux GOARCH=ppc64le $(MAKE) build-platform-binaries
.PHONY: build-platform-binaries
build-platform-binaries: build-agent \
build-ingester \
build-gateway \
build-promtail \
build-promtail-ingester \
build-promtail-gateway \
.PHONY: build-all-platforms
build-all-platforms: build-binaries-linux build-binaries-windows build-binaries-darwin build-binaries-s390x build-binaries-arm64 build-binaries-ppc64le