#!/usr/bin/make -f

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already). Refer to
# the section "Calling GNU configure properly" in
# /usr/share/doc/autotools-dev/README.Debian.gz for more details.
export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

%:
	dh $@

override_dh_auto_configure:
	cp -f /usr/share/misc/config.guess .
	cp -f /usr/share/misc/config.sub .
	
	dh_auto_configure -- \
	  $(confflags) \
	  --enable-printing \
	  CXXFLAGS="$(CXXFLAGS) -Wall" \
	  LDFLAGS="$(LDFLAGS) -Wl,--as-needed"

override_dh_auto_install:
	dh_auto_install
	rm debian/wxmaxima/usr/share/wxMaxima/COPYING
