#!/usr/bin/make -f
#export DH_VERBOSE = 1


export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_CXXFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND =

include /usr/share/dpkg/pkg-info.mk

export MULTIARCH := $(DEB_HOST_MULTIARCH)
export VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -e 's/\+.*//')

# buggy archs
ifneq (,$(filter $(DEB_HOST_ARCH), armhf mips64el sparc64 x32))
  DEB_CXXFLAGS_MAINT_APPEND += -DAS_MAX_PORTABILITY
endif


%:
	dh $@ --with pkgkde_symbolshelper

execute_after_dh_auto_clean:
	-+$(MAKE) -C samples clean
	rm -rf debian/doxygen/output
	rm -rf Makefile
	rm -rf samples/Makefile

override_dh_auto_configure-arch:
	ln -sf debian/Makefile
	cd samples && ln -sf ../debian/Makefile.samples Makefile

override_dh_auto_test-arch:
	+CPPFLAGS="$(CPPFLAGS) -I../angelscript/include" LDFLAGS="$(LDFLAGS) -Wl,-rpath,../../../angelscript/lib -L../angelscript/lib" $(MAKE) -C samples test

override_dh_auto_build-indep: debian/doxygen/output

debian/doxygen/output:
	cd debian/doxygen && doxygen

execute_after_dh_install-indep:
	dh_doxygen
