#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

PARI_CFG = /usr/lib/$(DEB_HOST_MULTIARCH)/pari/pari.cfg
PARI_CFG_DBG = /usr/lib/$(DEB_HOST_MULTIARCH)/pari/pari.cfg.dbg

export DEB_CXXFLAGS_MAINT_SET=
export DEB_CPPFLAGS_MAINT_SET=
export DEB_CFLAGS_MAINT_SET = -Wall -g
export DEB_LDFLAGS_MAINT_SET= -Wl,-z,relro
NOOPT = noopt

ifneq (,$(findstring $(NOOPT),$(DEB_BUILD_OPTIONS)))
	DEB_CFLAGS_MAINT_SET += -O0
else
	DEB_CFLAGS_MAINT_SET += -O2
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --with-paricfg=$(PARI_CFG) --with-paricfg-dbg=$(PARI_CFG_DBG)

override_dh_auto_build:
	$(MAKE)
	$(MAKE) -C doc

override_dh_auto_install:
	dh_auto_install -- PACKAGE_TARNAME=pari-gp2c

override_dh_compress:
	dh_compress -X.pdf
