2016-02-19 02:16:41 +01:00
|
|
|
PWD := $(shell pwd)
|
|
|
|
GOPATH := $(shell go env GOPATH)
|
2017-06-27 03:07:06 +02:00
|
|
|
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
|
2017-06-02 23:05:51 +02:00
|
|
|
|
2019-09-12 01:27:59 +02:00
|
|
|
GOARCH := $(shell go env GOARCH)
|
2019-06-04 09:59:40 +02:00
|
|
|
GOOS := $(shell go env GOOS)
|
|
|
|
|
2019-09-21 01:19:56 +02:00
|
|
|
VERSION ?= $(shell git describe --tags)
|
|
|
|
TAG ?= "minio/minio:$(VERSION)"
|
|
|
|
|
2017-07-15 20:57:39 +02:00
|
|
|
all: build
|
2014-11-30 22:55:10 +01:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
checks: ## check dependencies
|
2018-02-14 05:59:19 +01:00
|
|
|
@echo "Checking dependencies"
|
2015-02-22 06:38:04 +01:00
|
|
|
@(env bash $(PWD)/buildscripts/checkdeps.sh)
|
2015-02-02 06:18:46 +01:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
help: ## print this help
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
getdeps: ## fetch necessary dependencies
|
2019-03-28 00:16:17 +01:00
|
|
|
@mkdir -p ${GOPATH}/bin
|
2021-05-25 23:17:33 +02:00
|
|
|
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.40.1
|
2021-11-05 20:20:08 +01:00
|
|
|
@echo "Installing msgp" && go install -v github.com/tinylib/msgp@latest
|
|
|
|
@echo "Installing stringer" && go install -v golang.org/x/tools/cmd/stringer@latest
|
2015-03-10 00:15:06 +01:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
crosscompile: ## cross compile minio
|
2019-01-22 04:57:23 +01:00
|
|
|
@(env bash $(PWD)/buildscripts/cross-compile.sh)
|
|
|
|
|
2021-03-04 23:27:38 +01:00
|
|
|
verifiers: getdeps lint check-gen
|
2020-09-28 22:33:34 +02:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
check-gen: ## check for updated autogenerated files
|
2020-09-28 22:33:34 +02:00
|
|
|
@go generate ./... >/dev/null
|
2020-10-02 20:10:39 +02:00
|
|
|
@(! git diff --name-only | grep '_gen.go$$') || (echo "Non-committed changes in auto-generated code is detected, please commit them to proceed." && false)
|
2015-08-23 03:34:00 +02:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
lint: ## runs golangci-lint suite of linters
|
2019-09-12 01:27:59 +02:00
|
|
|
@echo "Running $@ check"
|
2020-05-18 18:59:45 +02:00
|
|
|
@GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean
|
2021-03-04 23:27:38 +01:00
|
|
|
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --build-tags kqueue --timeout=10m --config ./.golangci.yml
|
2020-08-24 21:11:20 +02:00
|
|
|
|
2017-07-15 20:57:39 +02:00
|
|
|
check: test
|
2021-10-01 20:53:06 +02:00
|
|
|
test: verifiers build ## builds minio, runs linters, tests
|
2017-09-13 01:56:33 +02:00
|
|
|
@echo "Running unit tests"
|
2021-11-05 20:20:08 +01:00
|
|
|
@GO111MODULE=on CGO_ENABLED=0 go test -tags kqueue ./... 1>/dev/null
|
2018-08-28 10:27:01 +02:00
|
|
|
|
2021-11-11 03:18:09 +01:00
|
|
|
test-race: verifiers build ## builds minio, runs linters, tests (race)
|
2020-01-10 11:35:06 +01:00
|
|
|
@echo "Running unit tests under -race"
|
|
|
|
@(env bash $(PWD)/buildscripts/race.sh)
|
|
|
|
|
2021-11-11 03:18:09 +01:00
|
|
|
test-iam: build ## verify IAM (external IDP, etcd backends)
|
2021-11-09 18:25:13 +01:00
|
|
|
@echo "Running tests for IAM (external IDP, etcd backends)"
|
|
|
|
@CGO_ENABLED=0 go test -tags kqueue -v -run TestIAM* ./cmd
|
|
|
|
@echo "Running tests for IAM (external IDP, etcd backends) with -race"
|
|
|
|
@CGO_ENABLED=1 go test -race -tags kqueue -v -run TestIAM* ./cmd
|
2021-11-04 16:16:30 +01:00
|
|
|
|
2021-11-11 03:18:09 +01:00
|
|
|
test-replication: install ## verify multi site replication
|
|
|
|
@echo "Running tests for Replication three sites"
|
|
|
|
@(env bash $(PWD)/docs/bucket/replication/setup_3site_replication.sh)
|
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
verify: ## verify minio various setups
|
2019-12-03 00:54:26 +01:00
|
|
|
@echo "Verifying build with race"
|
2021-04-30 05:55:21 +02:00
|
|
|
@GO111MODULE=on CGO_ENABLED=1 go build -race -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null
|
2017-09-13 01:56:33 +02:00
|
|
|
@(env bash $(PWD)/buildscripts/verify-build.sh)
|
2015-01-21 09:50:23 +01:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
verify-healing: ## verify healing and replacing disks with minio binary
|
2020-01-10 11:35:06 +01:00
|
|
|
@echo "Verify healing build with race"
|
2020-06-04 23:58:34 +02:00
|
|
|
@GO111MODULE=on CGO_ENABLED=1 go build -race -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null
|
2020-01-10 11:35:06 +01:00
|
|
|
@(env bash $(PWD)/buildscripts/verify-healing.sh)
|
2016-08-05 01:48:50 +02:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
build: checks ## builds minio to $(PWD)
|
2018-02-14 05:59:19 +01:00
|
|
|
@echo "Building minio binary to './minio'"
|
2020-06-04 23:58:34 +02:00
|
|
|
@GO111MODULE=on CGO_ENABLED=0 go build -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null
|
2014-11-02 01:04:24 +01:00
|
|
|
|
2021-02-09 18:29:43 +01:00
|
|
|
hotfix-vars:
|
|
|
|
$(eval LDFLAGS := $(shell MINIO_RELEASE="RELEASE" MINIO_HOTFIX="hotfix.$(shell git rev-parse --short HEAD)" go run buildscripts/gen-ldflags.go $(shell git describe --tags --abbrev=0 | \
|
|
|
|
sed 's#RELEASE\.\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)T\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)Z#\1-\2-\3T\4:\5:\6Z#')))
|
|
|
|
$(eval TAG := "minio/minio:$(shell git describe --tags --abbrev=0).hotfix.$(shell git rev-parse --short HEAD)")
|
2021-10-01 20:53:06 +02:00
|
|
|
hotfix: hotfix-vars install ## builds minio binary with hotfix tags
|
2020-12-08 17:12:13 +01:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
docker-hotfix: hotfix checks ## builds minio docker container with hotfix tags
|
2021-01-29 00:54:41 +01:00
|
|
|
@echo "Building minio docker image '$(TAG)'"
|
|
|
|
@docker build -t $(TAG) . -f Dockerfile.dev
|
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
docker: build checks ## builds minio docker container
|
2020-06-28 17:15:15 +02:00
|
|
|
@echo "Building minio docker image '$(TAG)'"
|
2018-09-25 19:33:25 +02:00
|
|
|
@docker build -t $(TAG) . -f Dockerfile.dev
|
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
install: build ## builds minio and installs it to $GOPATH/bin.
|
2018-02-14 05:59:19 +01:00
|
|
|
@echo "Installing minio binary to '$(GOPATH)/bin/minio'"
|
2019-05-07 19:39:26 +02:00
|
|
|
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/minio $(GOPATH)/bin/minio
|
2018-02-14 05:59:19 +01:00
|
|
|
@echo "Installation successful. To learn more, try \"minio --help\"."
|
2014-11-02 01:04:24 +01:00
|
|
|
|
2021-10-01 20:53:06 +02:00
|
|
|
clean: ## cleanup all generated assets
|
2017-06-02 23:05:51 +02:00
|
|
|
@echo "Cleaning up all the generated files"
|
2016-02-11 01:40:09 +01:00
|
|
|
@find . -name '*.test' | xargs rm -fv
|
2019-02-13 13:59:36 +01:00
|
|
|
@find . -name '*~' | xargs rm -fv
|
2018-02-14 05:59:19 +01:00
|
|
|
@rm -rvf minio
|
|
|
|
@rm -rvf build
|
|
|
|
@rm -rvf release
|
2020-04-01 09:04:25 +02:00
|
|
|
@rm -rvf .verify*
|