# This makefile is useful for generating cdbkup packages.
# Beware! Some targets require specialized tools which may be
# unavailable on some platforms.
# 
# The targets are as follows:
# changelog	- update ChangeLog file in main directory.
# tarball	- make generic tarball with autoconf for any platform.
#
# $Id: Makefile,v 1.4 2002/01/13 01:52:18 jjgignac Exp $

PKGDIR = ..
CHANGELOG = ChangeLog
VERSION = `head -1 ../src/CDVER | sed 's/[[:space:]]/_/g'`
TMP = /tmp
CDTEMP = $(TMP)/cdbkup

all:	prepare tarball

changelog:
	for x in $(PKGDIR) ; \
	do \
		( cd $$x ; \
		rcs2log -h users.sourceforge.net | \
		sed 's/\/cvsroot\/cdbkup\/cdbkup\///g' | \
		fmt > $(CHANGELOG) ) ; \
	done

prepare:
	@ echo "-> Be sure making 'make clean' before."

tarball:
	@ echo "-> Making tarball ..."
	rm -rf $(CDTEMP) ; rm -rf $(CDTEMP)-$(VERSION)
	mkdir $(CDTEMP)
	cp -R $(PKGDIR)/* $(CDTEMP) 
	mv $(CDTEMP) $(CDTEMP)-$(VERSION)
	tar -czf cdbkup-$(VERSION).tar.gz -C $(TMP) \
		--exclude CVS cdbkup-$(VERSION)
	@ echo "-> Output file name: cdbkup-$(VERSION).tar.gz"
