-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
51 lines (38 loc) · 1.68 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
DQLITE_BUILD_SCRIPTS_DIR ?= $(shell pwd)/hack
GO_SOURCES = $(shell find . -name '*.go')
BENCH_COUNT ?= 7
## Development
go.fmt:
go mod tidy
go fmt ./...
go.vet:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-vet.sh ./...
go.test:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-test.sh -v -p 1 ./...
go.bench:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-test.sh -v -p 1 ./... -run "^$$" -bench "Benchmark" -benchmem -count $(BENCH_COUNT)
## Static Builds
static: bin/static/k8s-dqlite bin/static/dqlite
$(DQLITE_BUILD_SCRIPTS_DIR)/.deps/static/lib/libdqlite.a:
$(DQLITE_BUILD_SCRIPTS_DIR)/static-dqlite.sh
bin/static/k8s-dqlite: $(DQLITE_BUILD_SCRIPTS_DIR)/.deps/static/lib/libdqlite.a $(GO_SOURCES)
mkdir -p bin/static
$(DQLITE_BUILD_SCRIPTS_DIR)/static-go-build.sh -o bin/static/k8s-dqlite ./k8s-dqlite.go
bin/static/dqlite: $(DQLITE_BUILD_SCRIPTS_DIR)/.deps/static/lib/libdqlite.a
mkdir -p bin/static
GOBIN=$(shell pwd)/bin/static $(DQLITE_BUILD_SCRIPTS_DIR)/static-go-install.sh github.com/canonical/go-dqlite/v2/cmd/[email protected]
## Dynamic Builds
dynamic: bin/dynamic/k8s-dqlite bin/dynamic/dqlite
bin/dynamic/lib/libdqlite.so:
mkdir -p bin/dynamic/lib
$(DQLITE_BUILD_SCRIPTS_DIR)/dynamic-dqlite.sh
cp -rv $(DQLITE_BUILD_SCRIPTS_DIR)/.deps/dynamic/lib/*.so* ./bin/dynamic/lib/
bin/dynamic/k8s-dqlite: bin/dynamic/lib/libdqlite.so $(GO_SOURCES)
mkdir -p bin/dynamic
$(DQLITE_BUILD_SCRIPTS_DIR)/dynamic-go-build.sh -o bin/dynamic/k8s-dqlite ./k8s-dqlite.go
bin/dynamic/dqlite: bin/dynamic/lib/libdqlite.so
mkdir -p bin/dynamic
GOBIN=$(shell pwd)/bin/dynamic $(DQLITE_BUILD_SCRIPTS_DIR)/dynamic-go-install.sh github.com/canonical/go-dqlite/v2/cmd/[email protected]
## Cleanup
clean:
rm -rf bin hack/.build hack/.deps