github.com/vrothberg/storage@v1.12.13/Makefile (about) 1 .PHONY: all binary clean cross default docs gccgo help install.tools local-binary local-cross local-gccgo local-test-integration local-test-unit local-validate test test-integration test-unit validate 2 3 PACKAGE := github.com/containers/storage 4 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) 5 GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g") 6 EPOCH_TEST_COMMIT := 0418ebf59f9e1f564831c0ba9378b7f8e40a1c73 7 NATIVETAGS := exclude_graphdriver_devicemapper exclude_graphdriver_btrfs exclude_graphdriver_overlay 8 AUTOTAGS := $(shell ./hack/btrfs_tag.sh) $(shell ./hack/libdm_tag.sh) $(shell ./hack/ostree_tag.sh) 9 BUILDFLAGS := -tags "$(AUTOTAGS) $(TAGS)" $(FLAGS) 10 GO := go 11 12 RUNINVM := vagrant/runinvm.sh 13 14 default all: local-binary docs local-validate local-cross local-gccgo test-unit test-integration ## validate all checks, build and cross-build\nbinaries and docs, run tests in a VM 15 16 clean: ## remove all built files 17 $(RM) -f containers-storage containers-storage.* docs/*.1 docs/*.5 18 19 sources := $(wildcard *.go cmd/containers-storage/*.go drivers/*.go drivers/*/*.go pkg/*/*.go pkg/*/*/*.go) layers_ffjson.go images_ffjson.go containers_ffjson.go pkg/archive/archive_ffjson.go 20 21 containers-storage: $(sources) ## build using gc on the host 22 $(GO) build -compiler gc $(BUILDFLAGS) ./cmd/containers-storage 23 24 layers_ffjson.go: layers.go 25 $(RM) $@ 26 ffjson layers.go 27 28 images_ffjson.go: images.go 29 $(RM) $@ 30 ffjson images.go 31 32 containers_ffjson.go: containers.go 33 $(RM) $@ 34 ffjson containers.go 35 36 pkg/archive/archive_ffjson.go: pkg/archive/archive.go 37 $(RM) $@ 38 ffjson pkg/archive/archive.go 39 40 binary local-binary: containers-storage 41 42 local-gccgo: ## build using gccgo on the host 43 GCCGO=$(PWD)/hack/gccgo-wrapper.sh $(GO) build -compiler gccgo $(BUILDFLAGS) -o containers-storage.gccgo ./cmd/containers-storage 44 45 local-cross: ## cross build the binaries for arm, darwin, and\nfreebsd 46 @for target in linux/amd64 linux/386 linux/arm darwin/amd64 windows/amd64 ; do \ 47 os=`echo $${target} | cut -f1 -d/` ; \ 48 arch=`echo $${target} | cut -f2 -d/` ; \ 49 suffix=$${os}.$${arch} ; \ 50 $(MAKE) GOOS=$${os} GOARCH=$${arch} FLAGS="-o containers-storage.$${suffix}" AUTOTAGS="$(NATIVETAGS)" local-binary || exit 1; \ 51 done 52 53 cross: ## cross build the binaries for arm, darwin, and\nfreebsd using VMs 54 $(RUNINVM) make local-$@ 55 56 docs: ## build the docs on the host 57 $(MAKE) -C docs docs 58 59 gccgo: ## build using gccgo using VMs 60 $(RUNINVM) make local-$@ 61 62 test: local-binary ## build the binaries and run the tests using VMs 63 $(RUNINVM) make local-binary local-cross local-test-unit local-test-integration 64 65 local-test-unit: local-binary ## run the unit tests on the host (requires\nsuperuser privileges) 66 @$(GO) test $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor) 67 68 test-unit: local-binary ## run the unit tests using VMs 69 $(RUNINVM) make local-$@ 70 71 local-test-integration: local-binary ## run the integration tests on the host (requires\nsuperuser privileges) 72 @cd tests; ./test_runner.bash 73 74 test-integration: local-binary ## run the integration tests using VMs 75 $(RUNINVM) make local-$@ 76 77 local-validate: ## validate DCO and gofmt on the host 78 @./hack/git-validation.sh 79 @./hack/gofmt.sh 80 81 validate: ## validate DCO, gofmt, ./pkg/ isolation, golint,\ngo vet and vendor using VMs 82 $(RUNINVM) make local-$@ 83 84 install.tools: 85 go get -u $(BUILDFLAGS) github.com/cpuguy83/go-md2man 86 go get -u $(BUILDFLAGS) github.com/vbatts/git-validation 87 go get -u $(BUILDFLAGS) gopkg.in/alecthomas/gometalinter.v1 88 go get -u $(BUILDFLAGS) github.com/pquerna/ffjson 89 gometalinter.v1 -i 90 91 help: ## this help 92 @awk 'BEGIN {FS = ":.*?## "} /^[a-z A-Z_-]+:.*?## / {gsub(" ",",",$$1);gsub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-21s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)