-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (41 loc) · 1.64 KB
/
Makefile
File metadata and controls
54 lines (41 loc) · 1.64 KB
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
PACKAGE = github.com/meterio/supernova
GIT_COMMIT = $(shell git --no-pager log --pretty="%h" -n 1)
GIT_TAG = $(shell git tag -l --points-at HEAD)
METER_VERSION = $(shell cat cmd/supernova/VERSION)
DISCO_VERSION = $(shell cat cmd/disco/VERSION)
PACKAGES = `go list ./... | grep -v '/vendor/'`
MAJOR = $(shell go version | cut -d' ' -f3 | cut -b 3- | cut -d. -f1)
MINOR = $(shell go version | cut -d' ' -f3 | cut -b 3- | cut -d. -f2)
export GO111MODULE=on
.PHONY: supernova disco mdb all clean test
supernova:| go_version_check
@echo "building $@..."
@go build -v -o $(CURDIR)/bin/$@ -ldflags "-X main.version=$(METER_VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.gitTag=$(GIT_TAG)" -tags '$(BUILD_TAGS)' ./cmd/supernova
@echo "done. executable created at 'bin/$@'"
mdb:| go_version_check
@echo "building $@..."
@go build -v -o $(CURDIR)/bin/$@ -ldflags "-X main.version=$(METER_VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.gitTag=$(GIT_TAG)" ./cmd/mdb
@echo "done. executable created at 'bin/$@'"
disco:| go_version_check
@echo "building $@..."
@go build -v -o $(CURDIR)/bin/$@ -ldflags "-X main.version=$(DISCO_VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.gitTag=$(GIT_TAG)" ./cmd/disco
@echo "done. executable created at 'bin/$@'"
dep:| go_version_check
@go mod download
go_version_check:
@if test $(MAJOR) -lt 1; then \
echo "Go 1.13 or higher required"; \
exit 1; \
else \
if test $(MAJOR) -eq 1 -a $(MINOR) -lt 13; then \
echo "Go 1.13 or higher required"; \
exit 1; \
fi \
fi
all: supernova disco mdb
clean:
-rm -rf \
$(CURDIR)/bin/supernova \
$(CURDIR)/bin/disco
test:| go_version_check
@go test -cover $(PACKAGES)