2015-11-07 20:16:33 +08:00
|
|
|
SHELL = /bin/bash
|
2017-07-08 04:31:27 +08:00
|
|
|
TAG := $(shell echo `git describe --abbrev=8 --tags`-`git rev-parse --abbrev-ref HEAD` | sed 's/-\([0-9]\)-/-00\1-/; s/-\([0-9][0-9]\)-/-0\1-/; s/-\(HEAD\|master\)$$//')
|
2014-04-25 01:11:08 +08:00
|
|
|
LAST_TAG := $(shell git describe --tags --abbrev=0)
|
2014-07-04 04:43:14 +08:00
|
|
|
NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f", $$_)')
|
2016-10-05 00:10:20 +08:00
|
|
|
GO_VERSION := $(shell go version)
|
2016-10-31 23:50:02 +08:00
|
|
|
GO_FILES := $(shell go list ./... | grep -v /vendor/ )
|
2017-08-29 21:22:07 +08:00
|
|
|
GO_LATEST := $(findstring go1.9,$(GO_VERSION))
|
2017-03-29 20:38:34 +08:00
|
|
|
BETA_URL := https://beta.rclone.org/$(TAG)/
|
2017-05-19 22:46:13 +08:00
|
|
|
# Pass in GOTAGS=xyz on the make command line to set build tags
|
|
|
|
ifdef GOTAGS
|
|
|
|
BUILDTAGS=-tags "$(GOTAGS)"
|
|
|
|
endif
|
2014-04-25 01:11:08 +08:00
|
|
|
|
2017-05-13 16:59:41 +08:00
|
|
|
.PHONY: rclone vars version
|
2017-02-27 19:53:03 +08:00
|
|
|
|
2014-07-19 20:12:20 +08:00
|
|
|
rclone:
|
2017-02-27 19:53:03 +08:00
|
|
|
touch fs/version.go
|
2017-05-19 22:46:13 +08:00
|
|
|
go install -v --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)" $(BUILDTAGS)
|
2017-02-27 19:53:03 +08:00
|
|
|
cp -av `go env GOPATH`/bin/rclone .
|
2014-07-19 20:12:20 +08:00
|
|
|
|
2016-09-08 15:04:13 +08:00
|
|
|
vars:
|
|
|
|
@echo SHELL="'$(SHELL)'"
|
|
|
|
@echo TAG="'$(TAG)'"
|
|
|
|
@echo LAST_TAG="'$(LAST_TAG)'"
|
|
|
|
@echo NEW_TAG="'$(NEW_TAG)'"
|
2016-10-05 00:10:20 +08:00
|
|
|
@echo GO_VERSION="'$(GO_VERSION)'"
|
|
|
|
@echo GO_LATEST="'$(GO_LATEST)'"
|
2016-10-08 18:23:21 +08:00
|
|
|
@echo BETA_URL="'$(BETA_URL)'"
|
2016-09-08 15:04:13 +08:00
|
|
|
|
2017-05-13 16:59:41 +08:00
|
|
|
version:
|
|
|
|
@echo '$(TAG)'
|
|
|
|
|
2016-07-13 19:25:19 +08:00
|
|
|
# Full suite of integration tests
|
2014-07-19 20:12:20 +08:00
|
|
|
test: rclone
|
2017-09-27 23:13:33 +08:00
|
|
|
-go test $(BUILDTAGS) $(GO_FILES) 2>&1 | tee test.log
|
|
|
|
-cd fs && go run $(BUILDTAGS) test_all.go 2>&1 | tee test_all.log
|
|
|
|
@echo "Written logs in test.log and fs/test_all.log"
|
2014-03-29 06:34:13 +08:00
|
|
|
|
2016-07-13 19:25:19 +08:00
|
|
|
# Quick test
|
|
|
|
quicktest:
|
2017-05-19 22:46:13 +08:00
|
|
|
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES)
|
2017-06-19 15:07:50 +08:00
|
|
|
ifdef GO_LATEST
|
2017-05-19 22:46:13 +08:00
|
|
|
RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES)
|
2017-06-19 15:07:50 +08:00
|
|
|
endif
|
2016-07-13 19:25:19 +08:00
|
|
|
|
|
|
|
# Do source code quality checks
|
2015-09-23 01:47:16 +08:00
|
|
|
check: rclone
|
2016-10-05 00:10:20 +08:00
|
|
|
ifdef GO_LATEST
|
2017-08-29 21:22:07 +08:00
|
|
|
go vet $(BUILDTAGS) -printfuncs Debugf,Infof,Logf,Errorf ./...
|
2017-05-19 22:46:13 +08:00
|
|
|
errcheck $(BUILDTAGS) $(GO_FILES)
|
2016-10-31 23:50:02 +08:00
|
|
|
find . -name \*.go | grep -v /vendor/ | xargs goimports -d | grep . ; test $$? -eq 1
|
2017-09-10 13:43:13 +08:00
|
|
|
go list ./... | grep -v /vendor/ | xargs -n1 golint | grep -E -v '(StorageUrl|CdnUrl)' ; test $$? -eq 1
|
2016-10-05 00:10:20 +08:00
|
|
|
else
|
|
|
|
@echo Skipping tests as not on Go stable
|
|
|
|
endif
|
2015-09-23 01:47:16 +08:00
|
|
|
|
2016-07-13 19:25:19 +08:00
|
|
|
# Get the build dependencies
|
|
|
|
build_dep:
|
2016-10-05 00:10:20 +08:00
|
|
|
ifdef GO_LATEST
|
2016-07-13 19:25:19 +08: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-05 00:10:20 +08:00
|
|
|
go get -u github.com/inconshreveable/mousetrap
|
2016-11-19 18:04:22 +08:00
|
|
|
go get -u github.com/tools/godep
|
2016-10-05 00:10:20 +08:00
|
|
|
endif
|
2016-07-13 19:25:19 +08:00
|
|
|
|
|
|
|
# Update dependencies
|
|
|
|
update:
|
2017-07-23 15:51:57 +08:00
|
|
|
go get -u github.com/golang/dep/cmd/dep
|
2017-05-11 22:39:54 +08:00
|
|
|
dep ensure -update -v
|
2016-07-13 19:25:19 +08:00
|
|
|
|
2015-06-06 17:05:21 +08:00
|
|
|
doc: rclone.1 MANUAL.html MANUAL.txt
|
2014-04-25 01:11:08 +08:00
|
|
|
|
2015-06-06 17:05:21 +08:00
|
|
|
rclone.1: MANUAL.md
|
|
|
|
pandoc -s --from markdown --to man MANUAL.md -o rclone.1
|
2014-04-25 01:11:08 +08:00
|
|
|
|
2016-10-04 18:37:31 +08:00
|
|
|
MANUAL.md: bin/make_manual.py docs/content/*.md commanddocs
|
|
|
|
./bin/make_manual.py
|
2014-04-25 01:11:08 +08:00
|
|
|
|
2015-06-06 17:05:21 +08: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-25 01:11:08 +08:00
|
|
|
|
2016-08-04 04:36:28 +08:00
|
|
|
commanddocs: rclone
|
|
|
|
rclone gendocs docs/content/commands/
|
|
|
|
|
2014-04-25 01:11:08 +08:00
|
|
|
install: rclone
|
|
|
|
install -d ${DESTDIR}/usr/bin
|
2014-07-19 20:12:20 +08:00
|
|
|
install -t ${DESTDIR}/usr/bin ${GOPATH}/bin/rclone
|
2014-04-25 01:11:08 +08:00
|
|
|
|
2014-03-29 06:34:13 +08:00
|
|
|
clean:
|
2014-04-25 01:11:08 +08:00
|
|
|
go clean ./...
|
2014-03-29 06:34:13 +08:00
|
|
|
find . -name \*~ | xargs -r rm -f
|
2014-04-18 05:32:39 +08:00
|
|
|
rm -rf build docs/public
|
2017-09-30 23:02:00 +08:00
|
|
|
rm -f rclone fs/fs.test fs/test_all.log test.log
|
2014-03-29 06:34:13 +08:00
|
|
|
|
|
|
|
website:
|
2014-04-18 05:32:39 +08:00
|
|
|
cd docs && hugo
|
2014-03-29 06:34:13 +08:00
|
|
|
|
|
|
|
upload_website: website
|
2014-07-19 20:12:20 +08:00
|
|
|
rclone -v sync docs/public memstore:www-rclone-org
|
2014-03-29 06:34:13 +08:00
|
|
|
|
|
|
|
upload:
|
2014-07-19 20:12:20 +08:00
|
|
|
rclone -v copy build/ memstore:downloads-rclone-org
|
2014-03-29 06:34:13 +08:00
|
|
|
|
2015-11-24 05:58:54 +08:00
|
|
|
upload_github:
|
2016-10-04 18:37:31 +08:00
|
|
|
./bin/upload-github $(TAG)
|
2015-11-24 05:58:54 +08:00
|
|
|
|
2014-04-25 01:11:08 +08:00
|
|
|
cross: doc
|
2017-05-19 22:46:13 +08:00
|
|
|
go run bin/cross-compile.go -release current $(BUILDTAGS) $(TAG)
|
2014-03-29 06:34:13 +08:00
|
|
|
|
2016-02-21 18:29:48 +08:00
|
|
|
beta:
|
2017-05-19 22:46:13 +08:00
|
|
|
go run bin/cross-compile.go $(BUILDTAGS) $(TAG)β
|
2015-11-12 00:55:49 +08:00
|
|
|
rclone -v copy build/ memstore:pub-rclone-org/$(TAG)β
|
2017-03-29 20:38:34 +08:00
|
|
|
@echo Beta release ready at https://pub.rclone.org/$(TAG)%CE%B2/
|
2015-11-12 00:55:49 +08:00
|
|
|
|
2017-05-13 16:59:41 +08:00
|
|
|
log_since_last_release:
|
|
|
|
git log $(LAST_TAG)..
|
|
|
|
|
|
|
|
upload_beta:
|
|
|
|
rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ memstore:beta-rclone-org/$(TAG)
|
|
|
|
rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' build/ memstore:beta-rclone-org
|
|
|
|
@echo Beta release ready at $(BETA_URL)
|
|
|
|
|
2017-08-05 06:20:26 +08:00
|
|
|
compile_all:
|
|
|
|
ifdef GO_LATEST
|
|
|
|
go run bin/cross-compile.go -parallel 8 -compile-only $(BUILDTAGS) $(TAG)β
|
|
|
|
else
|
|
|
|
@echo Skipping compile all as not on Go stable
|
|
|
|
endif
|
|
|
|
|
2016-10-05 00:10:20 +08:00
|
|
|
travis_beta:
|
2017-02-21 01:08:07 +08:00
|
|
|
git log $(LAST_TAG).. > /tmp/git-log.txt
|
2017-06-19 15:16:35 +08:00
|
|
|
go run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt -exclude "^windows/" -parallel 8 $(BUILDTAGS) $(TAG)β
|
2017-02-21 02:02:45 +08:00
|
|
|
rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ memstore:beta-rclone-org/$(TAG)
|
|
|
|
rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' build/ memstore:beta-rclone-org
|
2016-10-08 18:23:21 +08:00
|
|
|
@echo Beta release ready at $(BETA_URL)
|
2016-10-05 00:10:20 +08:00
|
|
|
|
2017-07-23 01:16:46 +08:00
|
|
|
# Fetch the windows builds from appveyor
|
|
|
|
fetch_windows:
|
2017-07-23 03:43:20 +08:00
|
|
|
rclone -v copy --include 'rclone-v*-windows-*.zip' memstore:beta-rclone-org/$(TAG) build/
|
|
|
|
-#cp -av build/rclone-v*-windows-386.zip build/rclone-current-windows-386.zip
|
|
|
|
-#cp -av build/rclone-v*-windows-amd64.zip build/rclone-current-windows-amd64.zip
|
|
|
|
md5sum build/rclone-*-windows-*.zip | sort
|
2017-07-23 01:16:46 +08:00
|
|
|
|
2016-01-16 22:10:57 +08:00
|
|
|
serve: website
|
2014-04-18 05:32:39 +08:00
|
|
|
cd docs && hugo server -v -w
|
2014-04-25 01:11:08 +08:00
|
|
|
|
2016-02-01 01:50:13 +08:00
|
|
|
tag: doc
|
2014-04-25 01:11:08 +08:00
|
|
|
@echo "Old tag is $(LAST_TAG)"
|
|
|
|
@echo "New tag is $(NEW_TAG)"
|
2017-03-18 19:16:43 +08:00
|
|
|
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEW_TAG)\"\n" | gofmt > fs/version.go
|
2017-09-26 03:59:46 +08:00
|
|
|
echo -n "$(NEW_TAG)" > docs/layouts/shortcodes/version.html
|
2014-04-25 01:11:08 +08:00
|
|
|
git tag $(NEW_TAG)
|
2017-03-18 19:16:43 +08:00
|
|
|
@echo "Edit the new changelog in docs/content/changelog.md"
|
|
|
|
@echo " * $(NEW_TAG) -" `date -I` >> docs/content/changelog.md
|
|
|
|
@git log $(LAST_TAG)..$(NEW_TAG) --oneline >> docs/content/changelog.md
|
2014-04-25 01:11:08 +08:00
|
|
|
@echo "Then commit the changes"
|
2015-06-06 17:05:21 +08:00
|
|
|
@echo git commit -m \"Version $(NEW_TAG)\" -a -v
|
2014-04-25 01:11:08 +08:00
|
|
|
@echo "And finally run make retag before make cross etc"
|
|
|
|
|
|
|
|
retag:
|
2014-06-27 00:57:32 +08:00
|
|
|
git tag -f $(LAST_TAG)
|
2017-03-18 19:30:04 +08:00
|
|
|
|
|
|
|
startdev:
|
2017-03-18 19:16:43 +08:00
|
|
|
echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(LAST_TAG)-DEV\"\n" | gofmt > fs/version.go
|
|
|
|
git commit -m "Start $(LAST_TAG)-DEV development" fs/version.go
|
2014-07-27 00:18:29 +08:00
|
|
|
|
|
|
|
gen_tests:
|
2015-02-15 02:48:08 +08:00
|
|
|
cd fstest/fstests && go generate
|
2017-05-12 17:03:35 +08:00
|
|
|
|
|
|
|
winzip:
|
|
|
|
zip -9 rclone-$(TAG).zip rclone.exe
|
|
|
|
|