summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile76
1 files changed, 44 insertions, 32 deletions
diff --git a/Makefile b/Makefile
index 11ab8830c..df8549541 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,10 @@ ISODATE ?= $(shell date --iso-8601)
#Update to LIBSECCOMP_COMMIT should reflect in Dockerfile too.
LIBSECCOMP_COMMIT := release-2.3
+# Rarely if ever should integration tests take more than 50min,
+# caller may override in special circumstances if needed.
+GINKGOTIMEOUT ?= -timeout=50m
+
# If GOPATH not specified, use one in the local directory
ifeq ($(GOPATH),)
export GOPATH := $(CURDIR)/_output
@@ -68,28 +72,36 @@ all: binaries docs
default: help
+define PRINT_HELP_PYSCRIPT
+import re, sys
+
+print("Usage: make <target>")
+cmds = {}
+for line in sys.stdin:
+ match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
+ if match:
+ target, help = match.groups()
+ cmds.update({target: help})
+for cmd in sorted(cmds):
+ print(" * '%s' - %s" % (cmd, cmds[cmd]))
+endef
+export PRINT_HELP_PYSCRIPT
+
help:
- @echo "Usage: make <target>"
- @echo
- @echo " * 'install' - Install binaries to system locations"
- @echo " * 'binaries' - Build podman"
- @echo " * 'integration' - Execute integration tests"
- @echo " * 'clean' - Clean artifacts"
- @echo " * 'lint' - Execute the source code linter"
- @echo " * 'gofmt' - Verify the source code gofmt"
+ @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.gopathok:
ifeq ("$(wildcard $(GOPKGDIR))","")
mkdir -p "$(GOPKGBASEDIR)"
- ln -s "$(CURDIR)" "$(GOPKGBASEDIR)"
+ ln -sf "$(CURDIR)" "$(GOPKGBASEDIR)"
endif
touch $@
-lint: .gopathok varlink_generate
+lint: .gopathok varlink_generate ## Execute the source code linter
@echo "checking lint"
@./.tool/lint
-gofmt:
+gofmt: ## Verify the source code gofmt
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
git diff --exit-code
@@ -105,16 +117,16 @@ test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go)
$(GO) build -ldflags '$(LDFLAGS)' -o $@ $(PROJECT)/test/goecho
-podman: .gopathok $(PODMAN_VARLINK_DEPENDENCIES)
+podman: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman
$(GO) build -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o bin/$@ $(PROJECT)/cmd/podman
-podman-remote: .gopathok $(PODMAN_VARLINK_DEPENDENCIES)
+podman-remote: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on remote environment
$(GO) build -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS) remoteclient" -o bin/$@ $(PROJECT)/cmd/podman
-podman-remote-darwin: .gopathok $(PODMAN_VARLINK_DEPENDENCIES)
+podman-remote-darwin: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on remote OSX environment
GOOS=darwin $(GO) build -ldflags '$(LDFLAGS_PODMAN)' -tags "remoteclient containers_image_openpgp exclude_graphdriver_devicemapper" -o bin/$@ $(PROJECT)/cmd/podman
-local-cross: $(CROSS_BUILD_TARGETS)
+local-cross: $(CROSS_BUILD_TARGETS) ## Cross local compilation
bin/podman.cross.%: .gopathok
TARGET="$*"; \
@@ -122,7 +134,7 @@ bin/podman.cross.%: .gopathok
GOARCH="$${TARGET##*.}" \
$(GO) build -ldflags '$(LDFLAGS_PODMAN)' -tags '$(BUILDTAGS_CROSS)' -o "$@" $(PROJECT)/cmd/podman
-clean:
+clean: ## Clean artifacts
rm -rf \
.gopathok \
_output \
@@ -142,16 +154,16 @@ clean:
find . -name \*~ -delete
find . -name \#\* -delete
-libpodimage:
+libpodimage: ## Build the libpod image
${CONTAINER_RUNTIME} build -t ${LIBPOD_IMAGE} .
dbuild: libpodimage
${CONTAINER_RUNTIME} run --name=${LIBPOD_INSTANCE} --privileged -v ${PWD}:/go/src/${PROJECT} --rm ${LIBPOD_IMAGE} make all
-test: libpodimage
+test: libpodimage ## Run tests on built image
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e OCI_RUNTIME -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make clean all localunit install.catatonit localintegration
-integration: libpodimage
+integration: libpodimage ## Execute integration tests
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e OCI_RUNTIME -e CGROUP_MANAGER=cgroupfs -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make clean all install.catatonit localintegration
integration.fedora:
@@ -160,10 +172,10 @@ integration.fedora:
integration.centos:
DIST=CentOS sh .papr_prepare.sh
-shell: libpodimage
+shell: libpodimage ## Run the built image and attach a shell
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e CGROUP_MANAGER=cgroupfs -e TESTFLAGS -e OCI_RUNTIME -e TRAVIS -it --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} sh
-testunit: libpodimage
+testunit: libpodimage ## Run unittest on the built image
${CONTAINER_RUNTIME} run -e STORAGE_OPTIONS="--storage-driver=vfs" -e TESTFLAGS -e CGROUP_MANAGER=cgroupfs -e OCI_RUNTIME -e TRAVIS -t --privileged --rm -v ${CURDIR}:/go/src/${PROJECT} ${LIBPOD_IMAGE} make localunit
localunit: test/goecho/goecho varlink_generate
@@ -171,29 +183,29 @@ localunit: test/goecho/goecho varlink_generate
$(MAKE) -C contrib/cirrus/packer test
ginkgo:
- ginkgo -v -tags "$(BUILDTAGS)" -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/.
+ ginkgo -v -tags "$(BUILDTAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/.
ginkgo-remote:
- ginkgo -v -tags "$(BUILDTAGS) remoteclient" -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/.
+ ginkgo -v -tags "$(BUILDTAGS) remoteclient" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/.
localintegration: varlink_generate test-binaries ginkgo ginkgo-remote
-localsystem: .install.ginkgo .install.gomega
+localsystem: .install.ginkgo
ginkgo -v -noColor test/system/
-system.test-binary: .install.ginkgo .install.gomega
+system.test-binary: .install.ginkgo
$(GO) test -c ./test/system
-perftest:
+perftest: ## Build perf tests
$ cd contrib/perftest;go build
-run-perftest: perftest
+run-perftest: perftest ## Build and run perf tests
$ contrib/perftest/perftest
vagrant-check:
BOX=$(BOX) sh ./vagrant.sh
-binaries: varlink_generate podman podman-remote
+binaries: varlink_generate podman podman-remote ## Build podman
install.catatonit:
./hack/install_catatonit.sh
@@ -206,12 +218,12 @@ MANPAGES ?= $(MANPAGES_MD:%.md=%)
$(MANPAGES): %: %.md .gopathok
@sed -e 's/\((podman.*\.md)\)//' -e 's/\[\(podman.*\)\]/\1/' $< | $(GOMD2MAN) -in /dev/stdin -out $@
-docs: $(MANPAGES)
+docs: $(MANPAGES) ## Generate documentation
docker-docs: docs
(cd docs; ./dckrman.sh *.1)
-changelog:
+changelog: ## Generate changelog
@echo "Creating changelog from $(CHANGELOG_BASE) to $(CHANGELOG_TARGET)"
$(eval TMPFILE := $(shell mktemp))
$(shell cat changelog.txt > $(TMPFILE))
@@ -221,7 +233,7 @@ changelog:
$(shell cat $(TMPFILE) >> changelog.txt)
$(shell rm $(TMPFILE))
-install: .gopathok install.bin install.man install.cni install.systemd
+install: .gopathok install.bin install.man install.cni install.systemd ## Install binaries to system locations
install.bin:
install ${SELINUXOPT} -d -m 755 $(BINDIR)
@@ -274,7 +286,7 @@ uninstall:
.PHONY: install.tools
-install.tools: .install.gitvalidation .install.gometalinter .install.md2man .install.ginkgo
+install.tools: .install.gitvalidation .install.gometalinter .install.md2man .install.ginkgo ## Install needed tools
.install.vndr: .gopathok
$(GO) get github.com/LK4D4/vndr