#!/usr/bin/make -f
# Copyright (C) 2001,2002  Matt Kraai
#
# 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 2
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

binary: binary-arch binary-indep

binary-arch: build
	$(MAKE) install DESTDIR=debian/tmp
	strip --remove-section=.comment --remove-section=.note \
		debian/tmp/usr/bin/tina
	gzip -9 debian/tmp/usr/share/man/man1/tina.1

	install -p -d -m 755 debian/tmp/DEBIAN
	install -p    -m 755 debian/postinst debian/prerm debian/tmp/DEBIAN

	install -p -d -m 755 debian/tmp/usr/share/doc/tina
	install -p    -m 644 debian/changelog debian/tmp/usr/share/doc/tina
	gzip -9 debian/tmp/usr/share/doc/tina/changelog
	install -p    -m 644 debian/copyright debian/tmp/usr/share/doc/tina

	chown -R root.root debian/tmp
	chmod -R go=rX debian/tmp

	dpkg-shlibdeps debian/tmp/usr/bin/tina
	dpkg-gencontrol -isp
	dpkg --build debian/tmp ..

build:
	./configure --prefix=/usr --mandir=/usr/share/man
	$(MAKE)

clean:
	-$(MAKE) distclean
	rm -f debian/files debian/substvars
	rm -rf debian/tmp

.PHONY: binary binary-arch binary-indep build clean
