2015-11-07 13:16:33 +01:00
|
|
|
SHELL = /bin/bash
|
2016-10-04 18:10:20 +02:00
|
|
|
TAG := $(shell echo `git describe --tags`-`git rev-parse --abbrev-ref HEAD` | sed 's/-\([0-9]\)-/-0\1-/; s/-\(HEAD\|master\)$$//')
|
2014-04-24 19:11:08 +02:00
|
|
|
LAST_TAG := $(shell git describe --tags --abbrev=0)
|
2014-07-03 22:43:14 +02:00
|
|
|
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)')
|
2016-10-04 18:10:20 +02:00
|
|
|
GO_VERSION := $(shell go version)
|
2016-10-31 16:50:02 +01:00
|
|
|
GO_FILES := $(shell go list ./... | grep -v /vendor/ )
|
2016-10-04 18:10:20 +02:00
|
|
|
GO_LATEST := $(findstring go1.7,$(GO_VERSION))
|
2016-10-08 12:23:21 +02:00
|
|
|
BETA_URL := http://beta.rclone.org/$(TAG)/
|
2016-10-31 16:50:02 +01:00
|
|
|
# Only needed for Go 1.5
|
|
|
|
export GO15VENDOREXPERIMENT=1
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2014-07-19 14:12:20 +02:00
|
|
|
rclone:
|
2016-10-31 16:50:02 +01:00
|
|
|
go install -v
|
2014-07-19 14:12:20 +02:00
|
|
|
|
2016-09-08 09:04:13 +02:00
|
|
|
vars:
|
|
|
|
@echo SHELL="'$(SHELL)'"
|
|
|
|
@echo TAG="'$(TAG)'"
|
|
|
|
@echo LAST_TAG="'$(LAST_TAG)'"
|
|
|
|
@echo NEW_TAG="'$(NEW_TAG)'"
|
2016-10-04 18:10:20 +02:00
|
|
|
@echo GO_VERSION="'$(GO_VERSION)'"
|
|
|
|
@echo GO_LATEST="'$(GO_LATEST)'"
|
2016-10-08 12:23:21 +02:00
|
|
|
@echo BETA_URL="'$(BETA_URL)'"
|
2016-09-08 09:04:13 +02:00
|
|
|
|
2016-07-13 13:25:19 +02:00
|
|
|
# Full suite of integration tests
|
2014-07-19 14:12:20 +02:00
|
|
|
test: rclone
|
2016-10-31 16:50:02 +01:00
|
|
|
go test $(GO_FILES)
|
2015-12-30 01:18:31 +01:00
|
|
|
cd fs && go run test_all.go
|
2014-03-28 23:34:13 +01:00
|
|
|
|
2016-07-13 13:25:19 +02:00
|
|
|
# Quick test
|
|
|
|
quicktest:
|
2016-10-31 16:50:02 +01:00
|
|
|
go test $(GO_FILES)
|
|
|
|
go test -cpu=2 -race $(GO_FILES)
|
2016-07-13 13:25:19 +02:00
|
|
|
|
|
|
|
# Do source code quality checks
|
2015-09-22 19:47:16 +02:00
|
|
|
check: rclone
|
2016-10-04 18:10:20 +02:00
|
|
|
ifdef GO_LATEST
|
2016-10-31 16:50:02 +01:00
|
|
|
go vet $(GO_FILES)
|
|
|
|
errcheck $(GO_FILES)
|
|
|
|
find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1
|
|
|
|
go list ./... | grep -v /vendor/ | xargs -i golint {} | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1
|
2016-10-04 18:10:20 +02:00
|
|
|
else
|
|
|
|
@echo Skipping tests as not on Go stable
|
|
|
|
endif
|
2015-09-22 19:47:16 +02:00
|
|
|
|
2016-07-13 13:25:19 +02:00
|
|
|
# Get the build dependencies
|
|
|
|
build_dep:
|
2016-10-04 18:10:20 +02:00
|
|
|
ifdef GO_LATEST
|
2016-07-13 13:25:19 +02:00
|
|
|
go get -u github.com/kisielk/errcheck
|
|
|
|
go get -u golang.org/x/tools/cmd/goimports
|
|
|
|
go get -u github.com/golang/lint/golint
|
2016-10-04 18:10:20 +02:00
|
|
|
go get -u github.com/mitchellh/gox
|
|
|
|
go get -u github.com/inconshreveable/mousetrap
|
|
|
|
endif
|
2016-07-13 13:25:19 +02:00
|
|
|
|
|
|
|
# Update dependencies
|
|
|
|
update:
|
|
|
|
go get -t -u -f -v ./...
|
2016-11-06 15:50:52 +01:00
|
|
|
godep update ./...
|
2016-07-13 13:25:19 +02:00
|
|
|
|
2015-06-06 11:05:21 +02:00
|
|
|
doc: rclone.1 MANUAL.html MANUAL.txt
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2015-06-06 11:05:21 +02:00
|
|
|
rclone.1: MANUAL.md
|
|
|
|
pandoc -s --from markdown --to man MANUAL.md -o rclone.1
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2016-10-04 12:37:31 +02:00
|
|
|
MANUAL.md: bin/make_manual.py docs/content/*.md commanddocs
|
|
|
|
./bin/make_manual.py
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2015-06-06 11:05:21 +02:00
|
|
|
MANUAL.html: MANUAL.md
|
|
|
|
pandoc -s --from markdown --to html MANUAL.md -o MANUAL.html
|
|
|
|
|
|
|
|
MANUAL.txt: MANUAL.md
|
|
|
|
pandoc -s --from markdown --to plain MANUAL.md -o MANUAL.txt
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2016-08-03 22:36:28 +02:00
|
|
|
commanddocs: rclone
|
|
|
|
rclone gendocs docs/content/commands/
|
|
|
|
|
2014-04-24 19:11:08 +02:00
|
|
|
install: rclone
|
|
|
|
install -d ${DESTDIR}/usr/bin
|
2014-07-19 14:12:20 +02:00
|
|
|
install -t ${DESTDIR}/usr/bin ${GOPATH}/bin/rclone
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2014-03-28 23:34:13 +01:00
|
|
|
clean:
|
2014-04-24 19:11:08 +02:00
|
|
|
go clean ./...
|
2014-03-28 23:34:13 +01:00
|
|
|
find . -name \*~ | xargs -r rm -f
|
2014-04-17 23:32:39 +02:00
|
|
|
rm -rf build docs/public
|
2016-01-31 17:33:20 +01:00
|
|
|
rm -f rclone rclonetest/rclonetest
|
2014-03-28 23:34:13 +01:00
|
|
|
|
|
|
|
website:
|
2014-04-17 23:32:39 +02:00
|
|
|
cd docs && hugo
|
2014-03-28 23:34:13 +01:00
|
|
|
|
|
|
|
upload_website: website
|
2014-07-19 14:12:20 +02:00
|
|
|
rclone -v sync docs/public memstore:www-rclone-org
|
2014-03-28 23:34:13 +01:00
|
|
|
|
|
|
|
upload:
|
2014-07-19 14:12:20 +02:00
|
|
|
rclone -v copy build/ memstore:downloads-rclone-org
|
2014-03-28 23:34:13 +01:00
|
|
|
|
2015-11-23 22:58:54 +01:00
|
|
|
upload_github:
|
2016-10-04 12:37:31 +02:00
|
|
|
./bin/upload-github $(TAG)
|
2015-11-23 22:58:54 +01:00
|
|
|
|
2014-04-24 19:11:08 +02:00
|
|
|
cross: doc
|
2016-10-04 12:37:31 +02:00
|
|
|
./bin/cross-compile $(TAG)
|
2014-03-28 23:34:13 +01:00
|
|
|
|
2016-02-21 11:29:48 +01:00
|
|
|
beta:
|
2016-10-04 12:37:31 +02:00
|
|
|
./bin/cross-compile $(TAG)β
|
2015-11-11 17:55:49 +01:00
|
|
|
rm build/*-current-*
|
|
|
|
rclone -v copy build/ memstore:pub-rclone-org/$(TAG)β
|
2015-11-30 11:10:41 +01:00
|
|
|
@echo Beta release ready at http://pub.rclone.org/$(TAG)%CE%B2/
|
2015-11-11 17:55:49 +01:00
|
|
|
|
2016-10-04 18:10:20 +02:00
|
|
|
travis_beta:
|
|
|
|
./bin/cross-compile $(TAG)β
|
|
|
|
rm build/*-current-*
|
|
|
|
rclone --config bin/travis.rclone.conf -v copy build/ memstore:beta-rclone-org/$(TAG)
|
2016-10-08 12:23:21 +02:00
|
|
|
@echo Beta release ready at $(BETA_URL)
|
2016-10-04 18:10:20 +02:00
|
|
|
|
2016-01-16 15:10:57 +01:00
|
|
|
serve: website
|
2014-04-17 23:32:39 +02:00
|
|
|
cd docs && hugo server -v -w
|
2014-04-24 19:11:08 +02:00
|
|
|
|
2016-01-31 18:50:13 +01:00
|
|
|
tag: doc
|
2014-04-24 19:11:08 +02:00
|
|
|
@echo "Old tag is $(LAST_TAG)"
|
|
|
|
@echo "New tag is $(NEW_TAG)"
|
2016-08-18 22:31:10 +02:00
|
|
|
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEW_TAG)-DEV\"\n" | gofmt > fs/version.go
|
2014-04-24 19:11:08 +02:00
|
|
|
perl -lpe 's/VERSION/${NEW_TAG}/g; s/DATE/'`date -I`'/g;' docs/content/downloads.md.in > docs/content/downloads.md
|
|
|
|
git tag $(NEW_TAG)
|
2015-06-06 11:05:21 +02:00
|
|
|
@echo "Add this to changelog in docs/content/changelog.md"
|
2014-06-26 18:57:32 +02:00
|
|
|
@echo " * $(NEW_TAG) -" `date -I`
|
2014-04-24 19:11:08 +02:00
|
|
|
@git log $(LAST_TAG)..$(NEW_TAG) --oneline
|
|
|
|
@echo "Then commit the changes"
|
2015-06-06 11:05:21 +02:00
|
|
|
@echo git commit -m \"Version $(NEW_TAG)\" -a -v
|
2014-04-24 19:11:08 +02:00
|
|
|
@echo "And finally run make retag before make cross etc"
|
|
|
|
|
|
|
|
retag:
|
2014-06-26 18:57:32 +02:00
|
|
|
git tag -f $(LAST_TAG)
|
2014-07-26 18:18:29 +02:00
|
|
|
|
|
|
|
gen_tests:
|
2015-02-14 19:48:08 +01:00
|
|
|
cd fstest/fstests && go generate
|