github.com/ncw/rclone@v1.48.1-0.20190724201158-a35aa1360e3e/Makefile (about)

     1  SHELL = bash
     2  BRANCH := $(or $(APPVEYOR_REPO_BRANCH),$(TRAVIS_BRANCH),$(shell git rev-parse --abbrev-ref HEAD))
     3  LAST_TAG := $(shell git describe --tags --abbrev=0)
     4  ifeq ($(BRANCH),$(LAST_TAG))
     5  	BRANCH := master
     6  endif
     7  TAG_BRANCH := -$(BRANCH)
     8  BRANCH_PATH := branch/
     9  ifeq ($(subst HEAD,,$(subst master,,$(BRANCH))),)
    10  	TAG_BRANCH :=
    11  	BRANCH_PATH :=
    12  endif
    13  TAG := $(shell echo $$(git describe --abbrev=8 --tags | sed 's/-\([0-9]\)-/-00\1-/; s/-\([0-9][0-9]\)-/-0\1-/'))$(TAG_BRANCH)
    14  NEW_TAG := $(shell echo $(LAST_TAG) | perl -lpe 's/v//; $$_ += 0.01; $$_ = sprintf("v%.2f.0", $$_)')
    15  ifneq ($(TAG),$(LAST_TAG))
    16  	TAG := $(TAG)-beta
    17  endif
    18  GO_VERSION := $(shell go version)
    19  GO_FILES := $(shell go list ./... | grep -v /vendor/ )
    20  BETA_PATH := $(BRANCH_PATH)$(TAG)
    21  BETA_URL := https://beta.rclone.org/$(BETA_PATH)/
    22  BETA_UPLOAD_ROOT := memstore:beta-rclone-org
    23  BETA_UPLOAD := $(BETA_UPLOAD_ROOT)/$(BETA_PATH)
    24  # Pass in GOTAGS=xyz on the make command line to set build tags
    25  ifdef GOTAGS
    26  BUILDTAGS=-tags "$(GOTAGS)"
    27  LINTTAGS=--build-tags "$(GOTAGS)"
    28  endif
    29  
    30  .PHONY: rclone vars version
    31  
    32  rclone:
    33  	touch fs/version.go
    34  	go install -v --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)" $(BUILDTAGS)
    35  	cp -av `go env GOPATH`/bin/rclone .
    36  
    37  vars:
    38  	@echo SHELL="'$(SHELL)'"
    39  	@echo BRANCH="'$(BRANCH)'"
    40  	@echo TAG="'$(TAG)'"
    41  	@echo LAST_TAG="'$(LAST_TAG)'"
    42  	@echo NEW_TAG="'$(NEW_TAG)'"
    43  	@echo GO_VERSION="'$(GO_VERSION)'"
    44  	@echo BETA_URL="'$(BETA_URL)'"
    45  
    46  version:
    47  	@echo '$(TAG)'
    48  
    49  # Full suite of integration tests
    50  test:	rclone
    51  	go install --ldflags "-s -X github.com/ncw/rclone/fs.Version=$(TAG)" $(BUILDTAGS) github.com/ncw/rclone/fstest/test_all
    52  	-test_all 2>&1 | tee test_all.log
    53  	@echo "Written logs in test_all.log"
    54  
    55  # Quick test
    56  quicktest:
    57  	RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) $(GO_FILES)
    58  
    59  racequicktest:
    60  	RCLONE_CONFIG="/notfound" go test $(BUILDTAGS) -cpu=2 -race $(GO_FILES)
    61  
    62  # Do source code quality checks
    63  check:	rclone
    64  	@echo "-- START CODE QUALITY REPORT -------------------------------"
    65  	@golangci-lint run $(LINTTAGS) ./...
    66  	@echo "-- END CODE QUALITY REPORT ---------------------------------"
    67  
    68  # Get the build dependencies
    69  build_dep:
    70  	go run bin/get-github-release.go -extract golangci-lint golangci/golangci-lint 'golangci-lint-.*\.tar\.gz'
    71  
    72  # Get the release dependencies
    73  release_dep:
    74  	go get -u github.com/goreleaser/nfpm/...
    75  	go get -u github.com/aktau/github-release
    76  
    77  # Update dependencies
    78  update:
    79  	GO111MODULE=on go get -u ./...
    80  	GO111MODULE=on go mod tidy
    81  	GO111MODULE=on go mod vendor
    82  
    83  doc:	rclone.1 MANUAL.html MANUAL.txt rcdocs commanddocs
    84  
    85  rclone.1:	MANUAL.md
    86  	pandoc -s --from markdown --to man MANUAL.md -o rclone.1
    87  
    88  MANUAL.md:	bin/make_manual.py docs/content/*.md commanddocs backenddocs
    89  	./bin/make_manual.py
    90  
    91  MANUAL.html:	MANUAL.md
    92  	pandoc -s --from markdown --to html MANUAL.md -o MANUAL.html
    93  
    94  MANUAL.txt:	MANUAL.md
    95  	pandoc -s --from markdown --to plain MANUAL.md -o MANUAL.txt
    96  
    97  commanddocs: rclone
    98  	XDG_CACHE_HOME="" XDG_CONFIG_HOME="" HOME="\$$HOME" USER="\$$USER" rclone gendocs docs/content/
    99  
   100  backenddocs: rclone bin/make_backend_docs.py
   101  	XDG_CACHE_HOME="" XDG_CONFIG_HOME="" HOME="\$$HOME" USER="\$$USER" ./bin/make_backend_docs.py
   102  
   103  rcdocs: rclone
   104  	bin/make_rc_docs.sh
   105  
   106  install: rclone
   107  	install -d ${DESTDIR}/usr/bin
   108  	install -t ${DESTDIR}/usr/bin ${GOPATH}/bin/rclone
   109  
   110  clean:
   111  	go clean ./...
   112  	find . -name \*~ | xargs -r rm -f
   113  	rm -rf build docs/public
   114  	rm -f rclone fs/operations/operations.test fs/sync/sync.test fs/test_all.log test.log
   115  
   116  website:
   117  	cd docs && hugo
   118  
   119  upload_website:	website
   120  	rclone -v sync docs/public memstore:www-rclone-org
   121  
   122  tarball:
   123  	git archive -9 --format=tar.gz --prefix=rclone-$(TAG)/ -o build/rclone-$(TAG).tar.gz $(TAG)
   124  
   125  sign_upload:
   126  	cd build && md5sum rclone-v* | gpg --clearsign > MD5SUMS
   127  	cd build && sha1sum rclone-v* | gpg --clearsign > SHA1SUMS
   128  	cd build && sha256sum rclone-v* | gpg --clearsign > SHA256SUMS
   129  
   130  check_sign:
   131  	cd build && gpg --verify MD5SUMS && gpg --decrypt MD5SUMS | md5sum -c
   132  	cd build && gpg --verify SHA1SUMS && gpg --decrypt SHA1SUMS | sha1sum -c
   133  	cd build && gpg --verify SHA256SUMS && gpg --decrypt SHA256SUMS | sha256sum -c
   134  
   135  upload:
   136  	rclone -P copy build/ memstore:downloads-rclone-org/$(TAG)
   137  	rclone lsf build --files-only --include '*.{zip,deb,rpm}' --include version.txt | xargs -i bash -c 'i={}; j="$$i"; [[ $$i =~ (.*)(-v[0-9\.]+-)(.*) ]] && j=$${BASH_REMATCH[1]}-current-$${BASH_REMATCH[3]}; rclone copyto -v "memstore:downloads-rclone-org/$(TAG)/$$i" "memstore:downloads-rclone-org/$$j"'
   138  
   139  upload_github:
   140  	./bin/upload-github $(TAG)
   141  
   142  cross:	doc
   143  	go run bin/cross-compile.go -release current $(BUILDTAGS) $(TAG)
   144  
   145  beta:
   146  	go run bin/cross-compile.go $(BUILDTAGS) $(TAG)
   147  	rclone -v copy build/ memstore:pub-rclone-org/$(TAG)
   148  	@echo Beta release ready at https://pub.rclone.org/$(TAG)/
   149  
   150  log_since_last_release:
   151  	git log $(LAST_TAG)..
   152  
   153  compile_all:
   154  	go run bin/cross-compile.go -compile-only $(BUILDTAGS) $(TAG)
   155  
   156  appveyor_upload:
   157  	rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ $(BETA_UPLOAD)
   158  ifndef BRANCH_PATH
   159  	rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' --include version.txt build/ $(BETA_UPLOAD_ROOT)
   160  endif
   161  	@echo Beta release ready at $(BETA_URL)
   162  
   163  circleci_upload:
   164  	./rclone --config bin/travis.rclone.conf -v copy build/ $(BETA_UPLOAD)/testbuilds
   165  ifndef BRANCH_PATH
   166  	./rclone --config bin/travis.rclone.conf -v copy build/ $(BETA_UPLOAD_ROOT)/test/testbuilds-latest
   167  endif
   168  	@echo Beta release ready at $(BETA_URL)/testbuilds
   169  
   170  travis_beta:
   171  ifeq ($(TRAVIS_OS_NAME),linux)
   172  	go run bin/get-github-release.go -extract nfpm goreleaser/nfpm 'nfpm_.*\.tar.gz'
   173  endif
   174  	git log $(LAST_TAG).. > /tmp/git-log.txt
   175  	go run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt $(BUILD_FLAGS) $(BUILDTAGS) $(TAG)
   176  	rclone --config bin/travis.rclone.conf -v copy --exclude '*beta-latest*' build/ $(BETA_UPLOAD)
   177  ifndef BRANCH_PATH
   178  	rclone --config bin/travis.rclone.conf -v copy --include '*beta-latest*' --include version.txt build/ $(BETA_UPLOAD_ROOT)
   179  endif
   180  	@echo Beta release ready at $(BETA_URL)
   181  
   182  # Fetch the binary builds from travis and appveyor
   183  fetch_binaries:
   184  	rclone -P sync --exclude "/testbuilds/**" --delete-excluded $(BETA_UPLOAD) build/
   185  
   186  serve:	website
   187  	cd docs && hugo server -v -w
   188  
   189  tag:	doc
   190  	@echo "Old tag is $(LAST_TAG)"
   191  	@echo "New tag is $(NEW_TAG)"
   192  	echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(NEW_TAG)\"\n" | gofmt > fs/version.go
   193  	echo -n "$(NEW_TAG)" > docs/layouts/partials/version.html
   194  	git tag -s -m "Version $(NEW_TAG)" $(NEW_TAG)
   195  	bin/make_changelog.py $(LAST_TAG) $(NEW_TAG) > docs/content/changelog.md.new
   196  	mv docs/content/changelog.md.new docs/content/changelog.md
   197  	@echo "Edit the new changelog in docs/content/changelog.md"
   198  	@echo "Then commit all the changes"
   199  	@echo git commit -m \"Version $(NEW_TAG)\" -a -v
   200  	@echo "And finally run make retag before make cross etc"
   201  
   202  retag:
   203  	git tag -f -s -m "Version $(LAST_TAG)" $(LAST_TAG)
   204  
   205  startdev:
   206  	echo -e "package fs\n\n// Version of rclone\nvar Version = \"$(LAST_TAG)-DEV\"\n" | gofmt > fs/version.go
   207  	git commit -m "Start $(LAST_TAG)-DEV development" fs/version.go
   208  
   209  winzip:
   210  	zip -9 rclone-$(TAG).zip rclone.exe