aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-02-06 22:45:51 +0100
committerGitHub <noreply@github.com>2019-02-06 22:45:51 +0100
commit72fcfb7e8624a4f61761d10f3bd80d9c6da3e31e (patch)
tree317145f0f39971269c0041734d751c55ebba3b0d
parent55dc783298875878ff080858fbd0e9d286d30794 (diff)
parente0c3af6523b5ce11877f63002c137b4c9f74a84b (diff)
downloadpodman-72fcfb7e8624a4f61761d10f3bd80d9c6da3e31e.tar.gz
podman-72fcfb7e8624a4f61761d10f3bd80d9c6da3e31e.tar.bz2
podman-72fcfb7e8624a4f61761d10f3bd80d9c6da3e31e.zip
Merge pull request #2283 from 4383/improve-makefile
Generate make helping message dynamicaly.
-rw-r--r--Makefile62
1 files changed, 35 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 391793daa..df8549541 100644
--- a/Makefile
+++ b/Makefile
@@ -72,15 +72,23 @@ 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))","")
@@ -89,11 +97,11 @@ ifeq ("$(wildcard $(GOPKGDIR))","")
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
@@ -109,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="$*"; \
@@ -126,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 \
@@ -146,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:
@@ -164,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
@@ -188,16 +196,16 @@ localsystem: .install.ginkgo
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
@@ -210,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))
@@ -225,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)
@@ -278,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