#!/bin/sh

#This creates a source tarball.

if test -a VERSION ; then
	VERSION="$(cat VERSION)"
	if test -a TARGET ; then
		TARGET="$(cat TARGET)"
#-------------------------------------------------------------
		echo "Building source tarball..."
		
		cd ..
		tar czvf ${TARGET}-${VERSION}-source.tar.gz ${TARGET} --exclude=*.gz --exclude=*.ipk --exclude=*.o --exclude=.* --exclude=*~ --exclude=backup --exclude=buildsrc --exclude=_dev 
		mv ${TARGET}-${VERSION}-source.tar.gz ${TARGET}/
		
		echo "All done."
#-------------------------------------------------------------
	else
		echo "ERROR: File \"TARGET\" not found. This is a text file with the project name inside it."
	fi
else
	echo "ERROR: File \"VERSION\" not found. This is a text file with the version number inside it."
fi
