changeset 536:acb751fa8eca

Add 'distcheck' target. Debian package build was broken.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Mon, 19 Nov 2012 20:14:06 +0200
parents b0c43c8d1467
children bb15ab8658ab
files printarg/Makefile
diffstat 1 files changed, 26 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/printarg/Makefile	Mon Nov 19 00:07:33 2012 +0200
+++ b/printarg/Makefile	Mon Nov 19 20:14:06 2012 +0200
@@ -12,6 +12,13 @@
 .DEFAULT_GOAL = all
 
 ################################################################
+# Project metadata.
+
+PKG_NAME := printarg
+PKG_VERSION := 1.0
+PKG := $(PKG_NAME)-$(PKG_VERSION)
+
+################################################################
 # Setup out of source build.
 
 S := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
@@ -144,30 +151,38 @@
 ################################################################
 # Packaging targets.
 
-.PHONY: dist-src
-dist-src:
-	mkdir ${B}printarg
-	cp $(patsubst %,${S}%,Makefile printarg.1 printarg.c printarg.cygport) ${B}printarg
-	tar zcf ${B}printarg.tar.gz -C ${B} printarg
-	rm -r ${B}printarg
+.PHONY: dist
+dist:
+	[ -e ${B}$(PKG) ] && { echo "** ${B}$(PKG) already exist, unexpected **"; exit 1; } || :
+	mkdir -p ${B}$(PKG)
+	cp $(patsubst %,${S}%,Makefile printarg.1 printarg.c printarg.cygport) ${B}$(PKG)
+	tar zcf ${B}$(PKG).tar.gz -C ${B} $(PKG)
+	rm -r ${B}$(PKG)
+
+.PHONY: distcheck
+distcheck: dist
+	tar zxf ${B}$(PKG).tar.gz -C ${B}
+	cd ${B}$(PKG)
+	make check
+	rm -r ${B}$(PKG)
 
 .PHONY: dist-cygwin
-dist-cygwin: dist-src
+dist-cygwin: dist
 	cygport printarg.cygport prep compile test install package finish
 
 .PHONY: debian-bootstrap
 debian-bootstrap:
 	DEBFULLNAME="Oleksandr Gavenko" DEBEMAIL=gavenkoa@gmail.com \
-	dh_make --createorig --single --addmissing --copyright mit --yes -p printarg_1.0
+	dh_make --createorig --single --addmissing --copyright mit --yes -p $(PKG_NAME)_$(PKG_VERSION)
 
 .PHONY: dist-debian
-dist-debian: dist-src
-	cp ${B}printarg.tar.gz ../printarg_1.0.orig.tar.gz
+dist-debian: dist
+	cp ${B}${PKG}.tar.gz ../${PKG_NAME}_${PKG_VERSION}.orig.tar.gz
 	debuild -us -uc
 
 .PHONY: dist-debian-check
 dist-debian-check: dist-debian
-	lintian -Ivi ../printarg_1.0-1_amd64.deb
+	lintian -Ivi ../${PKG_NAME}_${PKG_VERSION}-1_amd64.deb
 
 ################################################################
 # Clean targets.