## ccm for unix
## Lars Kellogg-Stedman <lars@larsshack.org>
## Ken Raeburn <raeburn@raeburn.org>
##
## $Id: Makefile.dist,v 1.3 1999/08/31 20:51:56 lars Exp $
##
## Distribution Makefile

all:
	@echo
	@echo "*** You must run the configure script before you can"
	@echo "*** build this package."
	@echo

dist:
	@if [ ! -d CVS ]; then \
		echo "ERROR: this does not appear to be a CVS repository." >&2;\
		exit 1;\
	fi; \
	v_major=`awk '/VERSION_MAJOR/ {print $$3}' version.h`;\
	v_minor=`awk '/VERSION_MINOR/ {print $$3}' version.h`;\
	v_revision=`awk '/VERSION_REVISION/ {print $$3}' version.h`;\
	v_string=$${v_major}.$${v_minor}.$${v_revision};\
	echo "Exporting current cvs tree...";\
	if cvs export -d ccm-$$v_string -D now ccm; then\
		echo; echo "Building configure script...";\
		(cd ccm-$$v_string; autoconf);\
		echo; echo "Activating distribution Makefile...";\
		mv ccm-$$v_string/Makefile.dist ccm-$$v_string/Makefile;\
		echo; echo "Building gzipped tar archive..."; \
		tar czvf ccm-$$v_string.tar.gz ccm-$$v_string;\
		rm -rf ccm-$$v_string;\
	else\
		echo "ERROR: cvs export failed." >&2;\
		exit 1;\
	fi
