forked from containers/storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the bundle-targeted build system with simpler Makefile targets and fewer helper scripts. Signed-off-by: Nalin Dahyabhai <[email protected]>
- Loading branch information
Showing
74 changed files
with
183 additions
and
2,978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,72 @@ | ||
.PHONY: all binary build build-binary build-gccgo bundles cross default docs gccgo test test-integration-cli test-unit validate help win tgz | ||
|
||
# set the graph driver as the current graphdriver if not set | ||
DRIVER := $(if $(STORAGE_DRIVER),$(STORAGE_DRIVER),$(if $(DOCKER_GRAPHDRIVER),DOCKER_GRAPHDRIVER),$(shell docker info 2>&1 | grep "Storage Driver" | sed 's/.*: //')) | ||
.PHONY: all binary build build-binary build-gccgo cross default docs gccgo test test-integration-cli test-unit validate help win tgz | ||
|
||
PACKAGE := github.com/containers/storage | ||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) | ||
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g") | ||
EPOCH_TEST_COMMIT := 0418ebf59f9e1f564831c0ba9378b7f8e40a1c73 | ||
SYSTEM_GOPATH := ${GOPATH} | ||
NATIVETAGS := exclude_graphdriver_devicemapper exclude_graphdriver_btrfs | ||
AUTOTAGS := $(shell ./hack/btrfs_tag.sh) $(shell ./hack/libdm_tag.sh) | ||
BUILDFLAGS := -tags "$(AUTOTAGS) $(TAGS)" $(FLAGS) | ||
GO := go | ||
|
||
RUNINVM := vagrant/runinvm.sh | ||
|
||
default all: build ## validate all checks, build linux binaries, run all tests\ncross build non-linux binaries and generate archives\nusing VMs | ||
$(RUNINVM) hack/make.sh | ||
|
||
build build-binary: bundles ## build using go on the host | ||
hack/make.sh binary | ||
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 | ||
|
||
build-gccgo: bundles ## build using gccgo on the host | ||
hack/make.sh gccgo | ||
clean: ## remove all built files | ||
$(RM) -f oci-storage oci-storage.* docs/*.1 | ||
|
||
binary: bundles | ||
$(RUNINVM) hack/make.sh binary | ||
binary local-binary: ## build using gc on the host | ||
$(GO) build -compiler gc $(BUILDFLAGS) ./cmd/oci-storage | ||
|
||
bundles: | ||
mkdir -p bundles | ||
local-gccgo: ## build using gccgo on the host | ||
GCCGO=$(PWD)/hack/gccgo-wrapper.sh $(GO) build -compiler gccgo $(BUILDFLAGS) -o oci-storage.gccgo ./cmd/oci-storage | ||
|
||
cross: build ## cross build the binaries for darwin, freebsd and windows\nusing VMs | ||
$(RUNINVM) hack/make.sh binary cross | ||
local-cross: ## cross build the binaries for arm, darwin, and\nfreebsd | ||
@for target in linux/amd64 linux/386 linux/arm darwin/amd64 ; do \ | ||
os=`echo $${target} | cut -f1 -d/` ; \ | ||
arch=`echo $${target} | cut -f2 -d/` ; \ | ||
suffix=$${os}.$${arch} ; \ | ||
$(MAKE) GOOS=$${os} GOARCH=$${arch} FLAGS="-o oci-storage.$${suffix}" AUTOTAGS="$(NATIVETAGS)" local-binary; \ | ||
done | ||
|
||
win: build ## cross build the binary for windows using VMs | ||
$(RUNINVM) hack/make.sh win | ||
|
||
tgz: build ## build the archives (.zip on windows and .tgz otherwise)\ncontaining the binaries on the host | ||
hack/make.sh binary cross tgz | ||
cross: ## cross build the binaries for arm, darwin, and\nfreebsd using VMs | ||
$(RUNINVM) make local-$@ | ||
|
||
docs: ## build the docs on the host | ||
$(MAKE) -C docs docs | ||
|
||
gccgo: build-gccgo ## build the gcc-go linux binaries using VMs | ||
$(RUNINVM) hack/make.sh gccgo | ||
|
||
test: build ## run the unit and integration tests using VMs | ||
$(RUNINVM) hack/make.sh binary cross test-unit | ||
gccgo: ## build using gccgo using VMs | ||
$(RUNINVM) make local-$@ | ||
|
||
test-unit: build ## run the unit tests using VMs | ||
$(RUNINVM) hack/make.sh test-unit | ||
test: local-binary ## build the binaries and run the tests using VMs | ||
$(RUNINVM) make local-binary local-cross local-test-unit local-test-integration | ||
|
||
validate: build ## validate DCO, Seccomp profile generation, gofmt,\n./pkg/ isolation, golint, tests, tomls, go vet and vendor\nusing VMs | ||
$(RUNINVM) hack/make.sh validate-dco validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet | ||
local-test-unit: local-binary ## run the unit tests on the host (requires\nsuperuser privileges) | ||
@$(GO) test $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor) | ||
|
||
lint: | ||
@which gometalinter > /dev/null 2>/dev/null || (echo "ERROR: gometalinter not found. Consider 'make install.tools' target" && false) | ||
@echo "checking lint" | ||
@./.tool/lint | ||
test-unit: local-binary ## run the unit tests using VMs | ||
$(RUNINVM) make local-$@ | ||
|
||
.PHONY: .gitvalidation | ||
# When this is running in travis, it will only check the travis commit range | ||
.gitvalidation: | ||
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false) | ||
ifeq ($(TRAVIS_EVENT_TYPE),pull_request) | ||
git-validation -q -run DCO,short-subject | ||
else ifeq ($(TRAVIS_EVENT_TYPE),push) | ||
git-validation -q -run DCO,short-subject -no-travis -range $(EPOCH_TEST_COMMIT)..$(TRAVIS_BRANCH) | ||
else | ||
git-validation -q -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD | ||
endif | ||
local-test-integration: local-binary ## run the integration tests on the host (requires\nsuperuser privileges) | ||
@cd tests; ./test_runner.sh | ||
|
||
.PHONY: install.tools | ||
|
||
install.tools: .install.gitvalidation .install.gometalinter .install.md2man | ||
test-integration: local-binary ## run the integration tests using VMs | ||
$(RUNINVM) make local-$@ | ||
|
||
.install.gitvalidation: | ||
GOPATH=${SYSTEM_GOPATH} go get github.com/vbatts/git-validation | ||
local-validate: ## validate DCO and gofmt on the host | ||
@./hack/git-validation.sh | ||
@./hack/gofmt.sh | ||
|
||
.install.gometalinter: | ||
GOPATH=${SYSTEM_GOPATH} go get github.com/alecthomas/gometalinter | ||
GOPATH=${SYSTEM_GOPATH} gometalinter --install | ||
validate: ## validate DCO, gofmt, ./pkg/ isolation, golint,\ngo vet and vendor using VMs | ||
$(RUNINVM) make local-$@ | ||
|
||
.install.md2man: | ||
GOPATH=${SYSTEM_GOPATH} go get github.com/cpuguy83/go-md2man | ||
.PHONY: install.tools | ||
install.tools: | ||
go get -u $(BUILDFLAGS) github.com/cpuguy83/go-md2man | ||
go get -u $(BUILDFLAGS) github.com/vbatts/git-validation | ||
go get -u $(BUILDFLAGS) gopkg.in/alecthomas/gometalinter.v1 | ||
gometalinter.v1 -i | ||
|
||
help: ## this help | ||
@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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.