#!/usr/bin/make -f

%:
	dh $@

no_hardening_all_archs = mips mipsel

ifeq (,$(filter $(DEB_HOST_ARCH),$(no_hardening_all_archs)))
  export DEB_BUILD_MAINT_OPTIONS = hardening=+all
endif

DPKG_EXPORT_BUILDFLAGS = 1

export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export LIBS := -lgl2ps -lGL -lGLU -lglut

include /usr/share/dpkg/buildflags.mk

override_dh_auto_configure:
	dh_auto_configure -- --prefix=/usr

override_dh_auto_build-indep:
	$(MAKE) doxygen

override_dh_auto_build-arch:
	dh_auto_build -a
	$(MAKE) man

override_dh_auto_install:
	sed -i 's/http\:\/\/www\.openlayers\.org\/api\//\/usr\/share\/javascript\/openlayers/g' $(CURDIR)/tools/webWizard/index.html
	dh_auto_install
	find . -type d -name "__pycache__" -delete

override_dh_auto_test-arch:
	mkdir $(CURDIR)/tests_auto
	cd $(CURDIR)/tests_auto; cp $(CURDIR)/debian/tests/hokkaido/* ./; SUMO_HOME=$(CURDIR) ../bin/sumo -b 0 -e 10000 -n net.net.xml -r input_routes.rou.xml --summary-output sum.out
	cat $(CURDIR)/tests_auto/sum.out
	rm -rf $(CURDIR)/tests_auto
