-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (33 loc) · 987 Bytes
/
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
FDB_CHECK := $(shell command -v fdbcli 2> /dev/null)
ROCKSDB_CHECK := $(shell echo "int main() { return 0; }" | gcc -lrocksdb -x c++ -o /dev/null - 2>/dev/null; echo $$?)
SQLITE_CHECK := $(shell echo "int main() { return 0; }" | gcc -lsqlite3 -x c++ -o /dev/null - 2>/dev/null; echo $$?)
TAGS =
ifdef FDB_CHECK
TAGS += foundationdb
endif
ifneq ($(shell go env GOOS), $(shell go env GOHOSTOS))
CROSS_COMPILE := 1
endif
ifneq ($(shell go env GOARCH), $(shell go env GOHOSTARCH))
CROSS_COMPILE := 1
endif
ifndef CROSS_COMPILE
ifeq ($(SQLITE_CHECK), 0)
TAGS += libsqlite3
endif
ifeq ($(ROCKSDB_CHECK), 0)
TAGS += rocksdb
CGO_CXXFLAGS := "${CGO_CXXFLAGS} -std=c++11"
CGO_FLAGS += CGO_CXXFLAGS=$(CGO_CXXFLAGS)
endif
endif
default: build
build: export GO111MODULE=on
build:
ifeq ($(TAGS),)
$(CGO_FLAGS) go build -o bin/go-ycsb cmd/go-ycsb/*
else
$(CGO_FLAGS) go build -tags "$(TAGS)" -o bin/go-ycsb cmd/go-ycsb/*
endif
check:
golint -set_exit_status db/... cmd/... pkg/...