#!/usr/bin/make -f

# Comment out to compile/test with gcc-snapshot.
#export CC  = /usr/lib/gcc-snapshot/bin/gcc
#export CXX = /usr/lib/gcc-snapshot/bin/g++
#export CPP = /usr/lib/gcc-snapshot/bin/cpp

# Make the build target only dependent on build-arch.  
override DEB_BUILD_DEPENDENCIES := build-arch

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

DEB_CONFIGURE_SCRIPT_ENV += CPPFLAGS="$(CPPFLAGS) -DHAVE_INLINE"
DEB_CONFIGURE_EXTRA_FLAGS := --with-gl
# --with-mpi (needs lam4-dev or libmpich1.0-dev)

DEB_INSTALL_DOCS_ALL = THANKS TODO
DEB_INSTALL_MANPAGES_xorsa := xorsa.1

# Avoid compressing files generated by doxygen and the xorsa examples.
DEB_COMPRESS_EXCLUDE := .php .idx .hhc .hhk .hhp .orsa

post-patches:: autoreconf-stamp
autoreconf-stamp:
	libtoolize -cf
	autoreconf -I macros
	touch $@

build/xorsa::
	docbook2x-man debian/manpages/xorsa.xml

build/liborsa-doc::
	cd src/liborsa && doxygen Doxyfile
	rm -rf `find src/liborsa -empty \( -type f -o -type d \)`

clean::
	dh_clean \
	  autoreconf-stamp \
	  xorsa.1
	rm -rf src/liborsa/html
