2015-05-10 20:43:42 +00:00
|
|
|
.PHONY: all clean env test bench gox test-integration
|
2014-08-05 21:13:19 +00:00
|
|
|
|
2015-05-10 20:43:42 +00:00
|
|
|
TMPGOPATH=$(PWD)/.gopath
|
|
|
|
VENDORPATH=$(PWD)/Godeps/_workspace
|
|
|
|
BASE=github.com/restic/restic
|
|
|
|
BASEPATH=$(TMPGOPATH)/src/$(BASE)
|
2015-01-14 16:32:37 +00:00
|
|
|
|
2015-05-10 20:43:42 +00:00
|
|
|
GOPATH=$(TMPGOPATH):$(VENDORPATH)
|
2015-01-14 16:32:37 +00:00
|
|
|
|
2015-05-10 20:43:42 +00:00
|
|
|
GOTESTFLAGS ?= -v
|
|
|
|
GOX_OS ?= linux darwin openbsd freebsd
|
|
|
|
SFTP_PATH ?= /usr/lib/ssh/sftp-server
|
|
|
|
|
|
|
|
export GOPATH GOX_OS
|
|
|
|
|
|
|
|
all: restic
|
|
|
|
|
|
|
|
.gopath:
|
|
|
|
mkdir -p .gopath/src/github.com/restic
|
|
|
|
ln -sf ../../../.. .gopath/src/github.com/restic/restic
|
|
|
|
|
|
|
|
restic: .gopath
|
|
|
|
cd $(BASEPATH) && \
|
|
|
|
go build -a -ldflags "-s" -o restic ./cmd/restic
|
|
|
|
|
|
|
|
restic.debug: .gopath
|
|
|
|
cd $(BASEPATH) && \
|
|
|
|
go build -a -tags debug -o restic ./cmd/restic
|
2014-08-05 21:13:19 +00:00
|
|
|
|
|
|
|
clean:
|
2015-05-10 20:43:42 +00:00
|
|
|
rm -rf .gopath restic *.cov restic_*
|
2015-01-14 20:36:33 +00:00
|
|
|
go clean ./...
|
2015-05-10 20:43:42 +00:00
|
|
|
|
|
|
|
test: .gopath
|
|
|
|
cd $(BASEPATH) && \
|
|
|
|
go test $(GOTESTFLAGS) ./...
|
|
|
|
|
|
|
|
bench: .gopath
|
|
|
|
cd $(BASEPATH) && \
|
|
|
|
go test GOTESTFLAGS) bench ./...
|
|
|
|
|
|
|
|
gox: .gopath
|
|
|
|
cd $(BASEPATH) && \
|
|
|
|
gox -verbose -os "$(GOX_OS)" ./cmd/restic
|
|
|
|
|
|
|
|
test-integration:
|
|
|
|
cd $(BASEPATH)/backend && \
|
|
|
|
go test $(GOTESTFLAGS) -test.sftppath $(SFTP_PATH) ./...
|
|
|
|
|
|
|
|
all.cov:
|
|
|
|
cd $(BASEPATH) && \
|
|
|
|
go list ./... | \
|
|
|
|
while read pkg; do \
|
|
|
|
go test -covermode=count -coverprofile=$$(base64 <<< $$pkg).cov $$pkg; \
|
|
|
|
done
|
|
|
|
echo "mode: count" > all.cov; tail -q -n +2 *.cov >> all.cov
|
|
|
|
|
|
|
|
env:
|
|
|
|
@echo export GOPATH=\"$(GOPATH)\"
|