#!/usr/bin/make -f

DESTDIR = $(CURDIR)/debian/inkscape

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

CFLAGS += -Wall
CXXFLAGS += -Wall

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -O0
  CXXFLAGS += -O0
else
  CFLAGS += -O2
  CXXFLAGS += -O2
endif

ifneq (,$(findstring $(DEB_HOST_ARCH),alpha))
  ALPHA_CFLAGS = -mieee
  ALPHA_CXXFLAGS = -mieee
  ALPHA_LDFLAGS = -Wl,--no-relax
endif

export DEB_CFLAGS_MAINT_APPEND := $(ALPHA_CFLAGS)
export DEB_CXXFLAGS_MAINT_APPEND := $(ALPHA_CXXFLAGS)
export DEB_LDFLAGS_MAINT_APPEND := $(ALPHA_LDFLAGS)

%:
	dh $@ --buildsystem=autoconf --parallel --with autoreconf,python2

override_dh_auto_configure:
	dh_auto_configure \
		--buildsystem=autoconf -- \
		--with-gnome-vfs \
		--enable-lcms

override_dh_install:
	install -D -o root -g root -m 644 $(CURDIR)/debian/inkscape.bash \
		$(DESTDIR)/etc/bash_completion.d/inkscape
	dh_install
