#================================ rand =================================
#Name: rand
#e-mail: gulyan89@yahoo.com
#Start date: 30 November - 2008
#
#Copyright (c)  2008		Guduleasa Alexandru Ionut
#				<gulyan89@yahoo.com>
#
#
#    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/>.

CC=gcc
package=rand
version=1.0.3
CFLAGS=-Wall
prefix=/usr/bin
mandir=/usr/share/man

test:
	$(CC) -c src/$(package).c -Wall
	$(CC) -o $(package) $(package).o

build:
	$(CC) -c src/$(package).c -Wall
	$(CC) -o $(package) $(package).o $(CFLAGS)

install:build man clean
	#copy the program
	mv $(package) $(prefix)/$(package)
	#copy manual
	mv $(package).1.gz $(mandir)/man1/$(package).1.gz

man:
	gzip -9 -c debian/$(package).1 > $(package).1.gz

tarball:clean
	tar -czvf ../$(package)-$(version).tar.gz --exclude CVS ../$(package)

orig:clean
	tar -czvf ../$(package)_$(version).orig.tar.gz --exclude CVS --exclude debian ../$(package)

remove:
	#remove the program
	rm $(prefix)/$(package)
	#remove manual
	rm $(mandir)/man1/$(package).1.gz

uninstall:remove

clean:
	rm -f *.o *~ src/*~ debian/*~
