#!/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
	R_PAPERSIZE=letter CC=egcc CFLAGS="-Wall -g -O2" FFLAGS="-Wall -g -O2"\
	 ./configure --prefix=/usr
	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

# 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 '/^RHOME=.*/s::RHOME=/usr/lib/R:' \
	    -e '/R.binary  /s::R.binary -v 8 -n 400000 :'\
	  < bin/R > debian/tmp/usr/bin/R
	dh_installdocs
	(cd debian/tmp/usr/doc/r-base && ln -s ../../lib/R/html . &&\
	  ln -s ../../lib/R/library .)
	dh_installmenu
	dh_installmanpages re_format.7 regex.3
	dh_installchangelogs CHANGES
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_makeshlibs
	dh_md5sums
	dh_builddeb

# Below here is fairly generic really

binary:		binary-indep binary-arch

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