From 2a3575495ad779185459a3294ad857ea7208c899 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 6 Jun 2016 20:09:47 +0200 Subject: [PATCH] Add `make release` target for simplified maintenance Signed-off-by: Joachim Nilsson --- Makefile.am | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Makefile.am b/Makefile.am index 97832ce..332eff6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,36 @@ pkgconfig_DATA = libeditline.pc doc_DATA = README LICENSE CHANGELOG EXTRA_DIST = LICENSE CHANGELOG INSTALL SUBDIRS = src include man examples + +## Generate MD5 checksum file +MD5 = md5sum +md5-dist: + @for file in $(DIST_ARCHIVES); do \ + $(MD5) $$file > $$file.md5; \ + done + +## Check if tagged in git +release-hook: + if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ + echo; \ + printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ + printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ + if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ + printf "OK, aborting release.\n"; \ + exit 1; \ + fi; \ + echo; \ + else \ + echo; \ + printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \ + printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \ + echo; \ + fi + +## Target to run when building a release +release: dist release-hook md5-dist + @for file in $(DIST_ARCHIVES); do \ + printf "$$file \tDistribution tarball\n"; \ + printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \ + mv $$file* ../; \ + done