-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
37 lines (29 loc) · 1.05 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
########################################
# cfs
########################################
ORG_PATH:=github.com/c-fs
REPO_PATH:=$(ORG_PATH)/cfs
$(eval TEST := $(shell cd ../../.. && find $(REPO_PATH) -name '*_test.go' | xargs -L 1 dirname | uniq | sort))
.PHONY: build
build:
mkdir -p bin
go build -o bin/cfs ${REPO_PATH}/server
go build -o bin/cfsctl ${REPO_PATH}/cfsctl
.PHONY: test
test: go-vet build
go test -p 8 -race $(TEST)
.PHONY: go-vet
go-vet:
@find . -name '*.go' | xargs -L 1 go tool vet
gofmt-check:
@test `gofmt -l . | wc -l` -eq 0
.PHONY: proto
proto:
protoc -I proto proto/*.proto --go_out=plugins=grpc:proto
.PHONY: docker
docker:
# Static binary built here may fail to call os/user/lookup functions due to library
# conflict. (http://stackoverflow.com/questions/8140439/why-would-it-be-impossible-to-fully-statically-link-an-application)
# Because cfs doesn't use these functions, it is ok to ignore the error.
go build -a -tags netgo -installsuffix netgo --ldflags '-extldflags "-static"' -o cfs ${REPO_PATH}/server
docker build -t c-fs/cfs .