forked from juicedata/juicefs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (56 loc) · 2.5 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
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 build -ldflags="$(LDFLAGS)" -o juicefs ./cmd
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 ./cmd
juicefs.ceph: Makefile cmd/*.go pkg/*/*.go
go build -tags ceph -ldflags="$(LDFLAGS)" -o juicefs.ceph ./cmd
# 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 ./cmd
/usr/local/include/winfsp:
sudo mkdir -p /usr/local/include/winfsp
sudo cp hack/winfsp_headers/* /usr/local/include/winfsp
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 ./cmd
.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 ./pkg/... -coverprofile=cov1.out
sudo JFS_GC_SKIPPEDTIME=1 `which go` test -v -cover ./cmd/... -coverprofile=cov2.out -coverpkg=./pkg/...,./cmd/...