-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (54 loc) · 2.23 KB
/
Copy pathMakefile
File metadata and controls
67 lines (54 loc) · 2.23 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
55
56
57
58
59
60
61
62
63
64
65
66
67
VERSION ?= dev
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -X github.com/sqlrush/opendb/internal/version.Version=$(VERSION) \
-X github.com/sqlrush/opendb/internal/version.GitCommit=$(GIT_COMMIT) \
-X github.com/sqlrush/opendb/internal/version.BuildDate=$(BUILD_DATE)
# All DB drivers (Oracle + MySQL + PostgreSQL + OpenGauss + GaussDB).
# `full` is the default for any production build — partial tags are only for
# special-purpose binaries (e.g. embedded, single-DB customer drops).
TAGS_OPENDB := full
TAGS_DBAA := full,dbaa
PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
.PHONY: build build-dbaa build-probe test lint clean release release-dbaa release-probe install
build:
go build -tags "$(TAGS_OPENDB)" -ldflags "$(LDFLAGS)" -o bin/opendb ./cmd/opendb
build-dbaa:
go build -tags "$(TAGS_DBAA)" -ldflags "$(LDFLAGS)" -o bin/dbaa ./cmd/opendb
build-probe:
go build -ldflags "$(LDFLAGS)" -o bin/gaussdb-probe ./cmd/gaussdb-probe
test:
go test -tags "$(TAGS_OPENDB)" ./... -race -cover
lint:
golangci-lint run --build-tags "$(TAGS_OPENDB)" ./...
clean:
rm -rf bin/
release: clean
@for platform in $(PLATFORMS); do \
GOOS=$$(echo $$platform | cut -d/ -f1) \
GOARCH=$$(echo $$platform | cut -d/ -f2) \
go build -tags "$(TAGS_OPENDB)" -ldflags "$(LDFLAGS)" \
-o bin/opendb-$$(echo $$platform | tr / -) ./cmd/opendb; \
done
@echo "OpenDB release binaries built in bin/"
@ls -la bin/
release-dbaa: clean
@for platform in $(PLATFORMS); do \
GOOS=$$(echo $$platform | cut -d/ -f1) \
GOARCH=$$(echo $$platform | cut -d/ -f2) \
go build -tags "$(TAGS_DBAA)" -ldflags "$(LDFLAGS)" \
-o bin/dbaa-$$(echo $$platform | tr / -) ./cmd/opendb; \
done
@echo "dbaa release binaries built in bin/"
@ls -la bin/
release-probe: clean
@for platform in $(PLATFORMS); do \
GOOS=$$(echo $$platform | cut -d/ -f1) \
GOARCH=$$(echo $$platform | cut -d/ -f2) \
go build -ldflags "$(LDFLAGS)" \
-o bin/gaussdb-probe-$$(echo $$platform | tr / -) ./cmd/gaussdb-probe; \
done
@echo "gaussdb-probe binaries built in bin/"
@ls -la bin/
install:
go install -tags "$(TAGS_OPENDB)" -ldflags "$(LDFLAGS)" ./cmd/opendb