.PHONY: help build extract TMUX := https://github.com/tmux/tmux.git LATEST = $(shell git ls-remote --tags $(TMUX) \ | egrep 'refs/tags/[0-9]+(\.[0-9]+)+[a-z]*$$' \ | tail -1 | cut -d/ -f3) IMAGE = tmux:$(LATEST) help: ## Display this help message @echo "Latest: $(LATEST)" @echo "Usage:" @sed -nE "s/^([^:]+):\s+##\s+(.+)$$/\tmake \\1\t- \\2/p" \ $(lastword $(MAKEFILE_LIST)) build: ## Build tmux in a docker image docker build \ --build-arg VERSION=$(LATEST) \ --tag $(IMAGE) \ --rm . extract: ## Extract the binaries from the docker image docker run \ -ti --rm \ -u $(shell id -u):$(shell id -g) \ -v $(CURDIR):/mnt/cwd \ -w /usr/local/lib \ $(IMAGE) tar czf /mnt/cwd/tmux_v$(LATEST).tar.gz tmux_v$(LATEST)