storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/Makefile (about) 1 PWD := $(shell pwd) 2 GOPATH := $(shell go env GOPATH) 3 LDFLAGS := $(shell go run buildscripts/gen-ldflags.go) 4 5 GOARCH := $(shell go env GOARCH) 6 GOOS := $(shell go env GOOS) 7 8 VERSION ?= $(shell git describe --tags) 9 TAG ?= "minio/minio:$(VERSION)" 10 11 all: build 12 13 checks: 14 @echo "Checking dependencies" 15 @(env bash $(PWD)/buildscripts/checkdeps.sh) 16 17 getdeps: 18 @mkdir -p ${GOPATH}/bin 19 @which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.27.0) 20 @which msgp 1>/dev/null || (echo "Installing msgp" && go get github.com/tinylib/msgp@v1.1.3) 21 @which stringer 1>/dev/null || (echo "Installing stringer" && go get golang.org/x/tools/cmd/stringer) 22 23 crosscompile: 24 @(env bash $(PWD)/buildscripts/cross-compile.sh) 25 26 verifiers: getdeps lint check-gen 27 28 check-gen: 29 @go generate ./... >/dev/null 30 @(! git diff --name-only | grep '_gen.go$$') || (echo "Non-committed changes in auto-generated code is detected, please commit them to proceed." && false) 31 32 lint: 33 @echo "Running $@ check" 34 @GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean 35 @GO111MODULE=on ${GOPATH}/bin/golangci-lint run --build-tags kqueue --timeout=10m --config ./.golangci.yml 36 37 # Builds minio, runs the verifiers then runs the tests. 38 check: test 39 test: verifiers build 40 @echo "Running unit tests" 41 @GOGC=25 GO111MODULE=on CGO_ENABLED=0 go test -tags kqueue ./... 1>/dev/null 42 43 test-race: verifiers build 44 @echo "Running unit tests under -race" 45 @(env bash $(PWD)/buildscripts/race.sh) 46 47 # Verify minio binary 48 verify: 49 @echo "Verifying build with race" 50 @GO111MODULE=on CGO_ENABLED=1 go build -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null 51 @(env bash $(PWD)/buildscripts/verify-build.sh) 52 53 # Verify healing of disks with minio binary 54 verify-healing: 55 @echo "Verify healing build with race" 56 @GO111MODULE=on CGO_ENABLED=1 go build -race -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null 57 @(env bash $(PWD)/buildscripts/verify-healing.sh) 58 59 # Builds minio locally. 60 build: checks 61 @echo "Building minio binary to './minio'" 62 @GO111MODULE=on CGO_ENABLED=0 go build -tags kqueue -trimpath --ldflags "$(LDFLAGS)" -o $(PWD)/minio 1>/dev/null 63 64 hotfix-vars: 65 $(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 | \ 66 sed 's#RELEASE\.\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)T\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)Z#\1-\2-\3T\4:\5:\6Z#'))) 67 $(eval TAG := "minio/minio:$(shell git describe --tags --abbrev=0).hotfix.$(shell git rev-parse --short HEAD)") 68 hotfix: hotfix-vars install 69 70 docker-hotfix: hotfix checks 71 @echo "Building minio docker image '$(TAG)'" 72 @docker build -t $(TAG) . -f Dockerfile.dev 73 74 docker: build checks 75 @echo "Building minio docker image '$(TAG)'" 76 @docker build -t $(TAG) . -f Dockerfile.dev 77 78 # Builds minio and installs it to $GOPATH/bin. 79 install: build 80 @echo "Installing minio binary to '$(GOPATH)/bin/minio'" 81 @mkdir -p $(GOPATH)/bin && cp -f $(PWD)/minio $(GOPATH)/bin/minio 82 @echo "Installation successful. To learn more, try \"minio --help\"." 83 84 clean: 85 @echo "Cleaning up all the generated files" 86 @find . -name '*.test' | xargs rm -fv 87 @find . -name '*~' | xargs rm -fv 88 @rm -rvf minio 89 @rm -rvf build 90 @rm -rvf release 91 @rm -rvf .verify*