#/* vim:set tabstop=4 textwidth=80 shiftwidth=4 cindent cino=(0,ml,\:0:
# * ( settings from: http://goanna.cs.rmit.edu.au/~nml/conventions.html )
# */
#
#/**********************************************************************
#    Medregator
#    Copyright (C) 2008-2010 DaTaPaX (Todd Harbour t/a)
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of the GNU General Public License
#    version 2 ONLY, as published by the Free Software Foundation.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program, in the file COPYING or COPYING.txt; if
#    not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
# **********************************************************************/

DIST_FILES = medregator.sh COPYING README Changelog Makefile

PROGVER="$$(grep APP_VER medregator.sh|head -1|cut -d'"' -f2)"
TARNAME="medregator-$(PROGVER).tar.gz"

.PHONY: err

err:
	@echo "No target specified (try dist)"

svnup:
	# Ensure up to date
	svn up

Changelog: svnup
	# Generate Changelog
	svn log >Changelog
	@echo "Making " $(TARNAME)

# tar -ztvf ~/medregator-0.12.tar.gz 
#-rwxr-xr-x krayon/users  20585 2010-09-13 12:28 medregator/medregator.sh
#-rw-r--r-- krayon/users  17987 2007-06-29 06:04 medregator/COPYING
#-rw------- krayon/users    769 2010-09-13 16:05 medregator/README
#-rw------- krayon/users   2299 2010-09-13 16:08 medregator/Changelog
	
dist: Changelog svnup
	@if [ -d medregator ]; then \
		echo "Directory medregator exists"; \
		exit 1; \
	fi

	@if [ -f "$(TARNAME)" ]; then \
		echo "Tarball exists"; \
		exit 2; \
	fi

	@mkdir medregator
	
	@cp $(DIST_FILES) medregator/
	@tar -zcvf "$(TARNAME)" medregator

clean:
	@echo "Cleaning..."
	
	@if [ -d medregator/ ]; then \
		rm -Rf medregator/; \
	fi

distclean: clean
	@echo "Cleaning (for distribution)..."
	@if [ -f "$(TARNAME)" ]; then \
		rm "$(TARNAME)"; \
	fi
	
	@if [ -f "Changelog" ]; then \
		rm "Changelog"; \
	fi
