#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=pgperl
ddir=`pwd`/debian/tmp

arch= $(shell dpkg --print-architecture)
perlvers = 5.004

build:
	$(checkdir)
	touch build
	perl Makefile.PL INSTALLDIRS=perl  INSTALLMAN1DIR=$(ddir)/usr/man/man1 INSTALLMAN3DIR=$(ddir)/usr/man/man3
	debian/fixmake
	debian/setprefix
	make CC=cc LD=cc LDDFLAGS="-shared -fpic"
#	make CC=cc LD=cc LDDFLAGS="-shared -fpic" LDFLAGS=     \
#	    EXTRALIBS=" -lcpgplot -lpgplot -L/usr/X11R6/lib -lX11  -lf2c -lm"  \
#	    LDLOADLIBS=" -lcpgplot -lpgplot -L/usr/X11R6/lib -lX11 -lf2c -lm" \
#	    LD_RUN_PATH=
clean:
	$(checkdir)
	-rm -f build
	-make clean
	-rm -rf blib
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp debian/files* core debian/substvars

binary-indep: checkroot build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: checkroot build
	$(checkdir)
	-rm -rf debian/tmp
	make install
	chmod 644 debian/tmp/usr/lib/perl5/$(arch)-linux/$(perlvers)/auto/PGPLOT/PGPLOT.so

	strip --strip-unneeded debian/tmp/usr/lib/perl5/$(arch)-linux/$(perlvers)/auto/PGPLOT/PGPLOT.so

	chmod 644 debian/tmp/usr/lib/perl5/$(arch)-linux/$(perlvers)/auto/PGPLOT/PGPLOT.bs
	cd debian/tmp; chmod 644  \
	   usr/lib/perl5/ExtUtils/F77.pm \
           usr/lib/perl5/PGPLOT.pm  \
           usr/man/man3/PGPLOT.3pm* \
           usr/man/man3/ExtUtils::F77.3pm*
# for perl 5.005
#	cd debian/tmp; chmod 644  \
#	   usr/lib/perl5/$(arch)-linux/$(perlvers)/ExtUtils/F77.pm \
#           usr/lib/perl5/$(arch)-linux/$(perlvers)/PGPLOT.pm  \
#           usr/man/man3/PGPLOT.3pm* \
#           usr/man/man3/ExtUtils::F77.3pm*
	rm -f debian/tmp/usr/lib/perl5/$(arch)-linux/$(perlvers)/perllocal.pod
	dpkg-shlibdeps blib/arch/auto/PGPLOT/PGPLOT.so
	debstd CHANGES README 
	dpkg-gencontrol
	chown -R root.root debian/tmp
	chmod -R go=rX debian/tmp
	dpkg --build debian/tmp ..

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

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




