#!/usr/bin/make -f
# debian/rules file for the Debian GNU/Linux r-base package
# Copyright 1997, 1998 by Douglas M. Bates <bates@stat.wisc.edu>

package=r-base

build:
	dh_testdir
	CFLAGS="-Wall -O2" FFLAGS="-Wall -O2"\
	 SHLIBLDFLAGS="-shared -lc" ./configure --prefix=/usr --with-g77
	make 
	make help
	make html

	touch build

clean:
	dh_testdir
	-rm -f build
	-make distclean
	-rm -f `find . -name "*~"`
	-rm -rf debian/tmp debian/files* core debian/substvars
	-rm -f doc/html/function.html doc/html/packages.html

# Build architecture-independent files here.
binary-indep: build
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	make install prefix=`pwd`/debian/tmp/usr
	sed -e '/{R_HOME=.*/s::{R_HOME=/usr/lib/R}:' \
	  < bin/R > debian/tmp/usr/bin/R
	sed -e '/{R_HOME=.*/s::{R_HOME=/usr/lib/R}:' \
	  < bin/R > debian/tmp/usr/lib/R/bin/R
	dh_installdocs
	(cd debian/tmp/usr/doc/r-base/doc && ln -s ../../../lib/R/doc/html .)
	(cd debian/tmp/usr/doc/r-base && ln -s ../../lib/R/library .)
	dh_installmenu
	dh_installmanpages re_format.7 regex.3
	dh_installchangelogs NEWS
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_makeshlibs
	dh_md5sums -X'usr/bin/R'  -XLibIndex -Xindex.txt -Xfunction.html -Xpackages.html
	dh_builddeb

# Below here is fairly generic really

binary:		binary-indep binary-arch

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