changeset 82:0a4367911035

Add a Makefile with some useful targets such as distinfo So I can make signed tarballs for distribution. The install-home target is taken from the evolve extension.
author Roy Marples <roy@marples.name>
date Mon, 18 Jan 2021 23:37:52 +0000
parents fec9b2b96c5f
children 29ffd23028c2
files Makefile
diffstat 1 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Mon Jan 18 23:37:52 2021 +0000
@@ -0,0 +1,60 @@
+HG?=		hg
+PYTHON?=	python
+
+CHMOD?=		chmod
+COMP?=		xz
+COMP_SUFFIX?=	.xz
+LS?=		ls
+RM?=		rm
+TAR?=		tar
+TAR_SUFFIX?=	.tar
+
+# This isn't very portable, but I generaly make releases from NetBSD
+CKSUM?=		cksum -a SHA256
+PGP?=		netpgp
+
+PACKAGE=	hg-fastimport
+PACKAGE_VER!=	$(PYTHON) setup.py --version
+
+TARFILE=	$(PACKAGE)-$(PACKAGE_VER)$(TAR_SUFFIX)
+DISTFILE=	$(TARFILE)$(COMP_SUFFIX)
+DISTINFO=	${DISTFILE}.distinfo
+DISTINFOSIGN=	${DISTINFO}.asc
+
+.PHONY: help
+help:
+	@echo "Commonly used make targets:"
+	@echo "  install-home   - install with setup.py install --home=$$HOME ($(HOME))"
+	@echo "  clean          - removes any targets created by setup.py"
+	@echo "  distclean      - in addition to clean, removes distribution tarballs"
+	@echo "  dist           - create a distribution tarball from hg repository"
+	@echo "  distinfo       - in addition to dist, sign the distribution tarballs"
+
+.PHONY: all
+all: help
+
+.PHONY: install-home
+install-home:
+	$(PYTHON) setup.py install --home="$(HOME)" --prefix="" --force
+
+.PHONY: clean
+clean:
+	$(RM) -rf build dist hg_fastimport.egg-info
+
+.PHONY: distclean
+distclean: clean
+	$(RM) -f $(PACKAGE)*$(TAR_SUFFIX)*
+
+.PHONY: dist
+dist: distclean
+	$(HG) archive $(TARFILE)
+	$(COMP) $(TARFILE)
+	@echo "created $(DISTFILE)"
+
+.PHONY: distinfo
+distinfo: dist
+	$(RM) -f $(DISTINFO) $(DISTINFOSIGN)
+	$(CKSUM) $(DISTFILE) >$(DISTINFO)
+	${PGP} --clearsign --output=$(DISTINFOSIGN) $(DISTINFO)
+	$(CHMOD) 644 $(DISTINFOSIGN)
+	$(LS) -l $(DISTFILE) $(DISTINFO) $(DISTINFOSIGN)