forked from juicedata/juicefs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (63 loc) · 2.94 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
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
export GO111MODULE=on
all: juicefs
REVISION := $(shell git rev-parse --short HEAD 2>/dev/null)
REVISIONDATE := $(shell git log -1 --pretty=format:'%ad' --date short 2>/dev/null)
PKG := github.com/juicedata/juicefs/pkg/version
LDFLAGS = -s -w
ifneq ($(strip $(REVISION)),) # Use git clone
LDFLAGS += -X $(PKG).revision=$(REVISION) \
-X $(PKG).revisionDate=$(REVISIONDATE)
endif
SHELL = /bin/sh
ifdef STATIC
LDFLAGS += -linkmode external -extldflags '-static'
CC = /usr/bin/musl-gcc
export CC
endif
juicefs: Makefile cmd/*.go pkg/*/*.go go.*
go version
go build -ldflags="$(LDFLAGS)" -o juicefs .
juicefs.lite: Makefile cmd/*.go pkg/*/*.go
go build -tags nogateway,nowebdav,nocos,nobos,nohdfs,noibmcos,noobs,nooss,noqingstor,noscs,nosftp,noswift,noupyun,noazure,nogs,noufile,nob2,nosqlite,nomysql,nopg,notikv,nobadger,noetcd \
-ldflags="$(LDFLAGS)" -o juicefs.lite .
juicefs.ceph: Makefile cmd/*.go pkg/*/*.go
go build -tags ceph -ldflags="$(LDFLAGS)" -o juicefs.ceph .
juicefs.fdb: Makefile cmd/*.go pkg/*/*.go
go build -tags fdb -ldflags="$(LDFLAGS)" -o juicefs.fdb .
# This is the script for compiling the Linux version on the MacOS platform.
# Please execute the `brew install FiloSottile/musl-cross/musl-cross` command before using it.
juicefs.linux:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-musl-gcc CGO_LDFLAGS="-static" go build -ldflags="$(LDFLAGS)" -o juicefs .
/usr/local/include/winfsp:
sudo mkdir -p /usr/local/include/winfsp
sudo cp hack/winfsp_headers/* /usr/local/include/winfsp
# This is the script for compiling the Windows version on the MacOS platform.
# Please execute the `brew install mingw-w64` command before using it.
juicefs.exe: /usr/local/include/winfsp cmd/*.go pkg/*/*.go
GOOS=windows CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc \
go build -ldflags="$(LDFLAGS)" -buildmode exe -o juicefs.exe .
.PHONY: snapshot release test
snapshot:
docker run --rm --privileged \
-e REVISIONDATE=$(REVISIONDATE) \
-e PRIVATE_KEY=${PRIVATE_KEY} \
-v ~/go/pkg/mod:/go/pkg/mod \
-v `pwd`:/go/src/github.com/juicedata/juicefs \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/juicedata/juicefs \
juicedata/golang-cross:latest release --snapshot --rm-dist --skip-publish
release:
docker run --rm --privileged \
-e REVISIONDATE=$(REVISIONDATE) \
-e PRIVATE_KEY=${PRIVATE_KEY} \
--env-file .release-env \
-v ~/go/pkg/mod:/go/pkg/mod \
-v `pwd`:/go/src/github.com/juicedata/juicefs \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/juicedata/juicefs \
juicedata/golang-cross:latest release --rm-dist
test:
go test -v -cover -count=1 -timeout=8m ./pkg/... -coverprofile=cov1.out
sudo JFS_GC_SKIPPEDTIME=1 MINIO_ACCESS_KEY=testUser MINIO_SECRET_KEY=testUserPassword go test -v -count=1 -cover -timeout=8m ./cmd/... -coverprofile=cov2.out -coverpkg=./pkg/...,./cmd/...
test.fdb:
go test -v -cover -count=1 -timeout=8m ./pkg/meta/ -tags fdb -run=TestFdb -coverprofile=cov3.out