#****************************************************************************************
#****    This file is part of ufpm.                                                 *****
#****                                                                               *****
#****    This program is free software: you can redistribute it and/or modify       *****
#****    it under the terms of the GNU General Public License as published by       *****
#****    the Free Software Foundation, either version 3 of the License, or          *****
#****    (at your option) any later version.                                        *****
#****                                                                               *****
#****    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.  If not, see <http://www.gnu.org/licenses/>.      *****
#****************************************************************************************
VERSION = 1.5.0
bindir = "/usr/bin"
datadir = "/usr/share"
mandir = "/usr/share/man"
DESTDIR = ""

ufpm: ufpm.sh
	@mv ufpm.sh ufpm
	@echo We are ready to install now.

.PHONY:all
all: ufpm

.PHONY:install
install:
	@echo We are going to install to ${DESTDIR}${bindir}...
	@mkdir --parent ${DESTDIR}${bindir}
	@cp ufpm ${DESTDIR}${bindir}
	@chown ${USER}:${USER} ${DESTDIR}${bindir}/ufpm
	@chmod 775 ${DESTDIR}${bindir}/ufpm
	@mkdir --parent ${DESTDIR}${mandir}/man1
	@cp ufpm.1 ${DESTDIR}${mandir}/man1
	@chmod 664 ${DESTDIR}${mandir}/man1/ufpm.1
	@echo We have installed ufpm.

.PHONY:uninstall
uninstall:
	@rm -f ${DESTDIR}${bindir}/ufpm
	@rm -f ${DESTDIR}${mandir}/man1/ufpm.1*
	@echo We have removed ufpm.

.PHONY:clean
clean:
	@rm -fdr *~ *core
	@echo Clean finished.

.PHONY:distclean
distclean:
	@rm -fdr *~ *core
	@mv ufpm ufpm.sh
	@echo Distribution clean finished.

.PHONY:tar
tar: ufpm.sh
	@cp --recursive . ../ufpm-${VERSION}
	@tar -zcf ../ufpm-${VERSION}.tar.gz --exclude=*~ --exclude=.svn* ../ufpm-${VERSION}
	@rm -fdr ../ufpm-${VERSION}
	@echo Tarball created.
