forked from jaegertracing/jaeger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.BuildBinaries.mk
171 lines (140 loc) · 5.76 KB
/
Makefile.BuildBinaries.mk
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Copyright (c) 2023 The Jaeger Authors.
# SPDX-License-Identifier: Apache-2.0
# This command expects $GOOS/$GOARCH env variables set to reflect the desired target platform.
GOBUILD=echo "building binary for $$(go env GOOS)-$$(go env GOARCH)"; \
CGO_ENABLED=0 installsuffix=cgo $(GO) build -trimpath
ifeq ($(DEBUG_BINARY),)
DISABLE_OPTIMIZATIONS =
SUFFIX =
TARGET = release
else
DISABLE_OPTIMIZATIONS = -gcflags="all=-N -l"
SUFFIX = -debug
TARGET = debug
endif
build-ui: cmd/query/app/ui/actual/index.html.gz
cmd/query/app/ui/actual/index.html.gz: jaeger-ui/packages/jaeger-ui/build/index.html
# do not delete dot-files
rm -rf cmd/query/app/ui/actual/*
cp -r jaeger-ui/packages/jaeger-ui/build/* cmd/query/app/ui/actual/
find cmd/query/app/ui/actual -type f | grep -v .gitignore | xargs gzip --no-name
# copy the timestamp for index.html.gz from the original file
touch -t $$(date -r jaeger-ui/packages/jaeger-ui/build/index.html '+%Y%m%d%H%M.%S') cmd/query/app/ui/actual/index.html.gz
ls -lF cmd/query/app/ui/actual/
jaeger-ui/packages/jaeger-ui/build/index.html:
$(MAKE) rebuild-ui
.PHONY: rebuild-ui
rebuild-ui:
@echo "::group::rebuild-ui logs"
bash ./scripts/rebuild-ui.sh
@echo "NOTE: This target only rebuilds the UI assets inside jaeger-ui/packages/jaeger-ui/build/."
@echo "NOTE: To make them usable from query-service run 'make build-ui'."
@echo "::endgroup::"
.PHONY: build-examples
build-examples:
$(GOBUILD) -o ./examples/hotrod/hotrod-$(GOOS)-$(GOARCH) ./examples/hotrod/main.go
.PHONY: build-tracegen
build-tracegen:
$(GOBUILD) $(BUILD_INFO) -o ./cmd/tracegen/tracegen-$(GOOS)-$(GOARCH) ./cmd/tracegen/
.PHONY: build-anonymizer
build-anonymizer:
$(GOBUILD) $(BUILD_INFO) -o ./cmd/anonymizer/anonymizer-$(GOOS)-$(GOARCH) ./cmd/anonymizer/
.PHONY: build-esmapping-generator
build-esmapping-generator:
$(GOBUILD) $(BUILD_INFO) -o ./plugin/storage/es/esmapping-generator-$(GOOS)-$(GOARCH) ./cmd/esmapping-generator/
.PHONY: build-esmapping-generator-linux
build-esmapping-generator-linux:
GOOS=linux $(BUILD_INFO) GOARCH=amd64 $(GOBUILD) -o ./plugin/storage/es/esmapping-generator ./cmd/esmapping-generator/
.PHONY: build-es-index-cleaner
build-es-index-cleaner:
$(GOBUILD) $(BUILD_INFO) -o ./cmd/es-index-cleaner/es-index-cleaner-$(GOOS)-$(GOARCH) ./cmd/es-index-cleaner/
.PHONY: build-es-rollover
build-es-rollover:
$(GOBUILD) $(BUILD_INFO) -o ./cmd/es-rollover/es-rollover-$(GOOS)-$(GOARCH) ./cmd/es-rollover/
# Requires variables: $(BIN_NAME) $(BIN_PATH) $(GO_TAGS) $(DISABLE_OPTIMIZATIONS) $(SUFFIX) $(GOOS) $(GOARCH) $(BUILD_INFO)
# Other targets can depend on this one but with a unique suffix to ensure it is always executed.
BIN_PATH = ./cmd/$(BIN_NAME)
.PHONY: _build-a-binary
_build-a-binary-%:
$(GOBUILD) $(DISABLE_OPTIMIZATIONS) $(GO_TAGS) -o $(BIN_PATH)/$(BIN_NAME)$(SUFFIX)-$(GOOS)-$(GOARCH) $(BUILD_INFO) $(BIN_PATH)
.PHONY: build-jaeger
build-jaeger: BIN_NAME = jaeger
build-jaeger: BUILD_INFO = $(BUILD_INFO_V2)
build-jaeger: build-ui _build-a-binary-jaeger$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-all-in-one
build-all-in-one: BIN_NAME = all-in-one
build-all-in-one: build-ui _build-a-binary-all-in-one$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-agent
build-agent: BIN_NAME = agent
build-agent: _build-a-binary-agent$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-query
build-query: BIN_NAME = query
build-query: build-ui _build-a-binary-query$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-collector
build-collector: BIN_NAME = collector
build-collector: _build-a-binary-collector$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-ingester
build-ingester: BIN_NAME = ingester
build-ingester: _build-a-binary-ingester$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-remote-storage
build-remote-storage: BIN_NAME = remote-storage
build-remote-storage: _build-a-binary-remote-storage$(SUFFIX)-$(GOOS)-$(GOARCH)
.PHONY: build-binaries-linux-amd64
build-binaries-linux-amd64:
GOOS=linux GOARCH=amd64 $(MAKE) _build-platform-binaries
# helper sysp targets are defined in Makefile.Windows.mk
.PHONY: build-binaries-windows-amd64
build-binaries-windows-amd64:
$(MAKE) _build-syso
GOOS=windows GOARCH=amd64 $(MAKE) _build-platform-binaries
$(MAKE) _clean-syso
.PHONY: build-binaries-darwin-amd64
build-binaries-darwin-amd64:
GOOS=darwin GOARCH=amd64 $(MAKE) _build-platform-binaries
.PHONY: build-binaries-darwin-arm64
build-binaries-darwin-arm64:
GOOS=darwin GOARCH=arm64 $(MAKE) _build-platform-binaries
.PHONY: build-binaries-linux-s390x
build-binaries-linux-s390x:
GOOS=linux GOARCH=s390x $(MAKE) _build-platform-binaries
.PHONY: build-binaries-linux-arm64
build-binaries-linux-arm64:
GOOS=linux GOARCH=arm64 $(MAKE) _build-platform-binaries
.PHONY: build-binaries-linux-ppc64le
build-binaries-linux-ppc64le:
GOOS=linux GOARCH=ppc64le $(MAKE) _build-platform-binaries
# build all binaries for one specific platform GOOS/GOARCH
.PHONY: _build-platform-binaries
_build-platform-binaries: \
build-agent \
build-all-in-one \
build-collector \
build-query \
build-ingester \
build-jaeger \
build-remote-storage \
build-examples \
build-tracegen \
build-anonymizer \
build-esmapping-generator \
build-es-index-cleaner \
build-es-rollover
# invoke make recursively such that DEBUG_BINARY=1 can take effect
$(MAKE) _build-platform-binaries-debug GOOS=$(GOOS) GOARCH=$(GOARCH) DEBUG_BINARY=1
# build binaries that support DEBUG release, for one specific platform GOOS/GOARCH
.PHONY: _build-platform-binaries-debug
_build-platform-binaries-debug:
_build-platform-binaries-debug: \
build-agent \
build-collector \
build-query \
build-ingester \
build-remote-storage \
build-all-in-one \
build-jaeger
.PHONY: build-all-platforms
build-all-platforms:
for platform in $$(echo "$(PLATFORMS)" | tr ',' ' ' | tr '/' '-'); do \
echo "Building binaries for $$platform"; \
$(MAKE) build-binaries-$$platform; \
done