#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ifneq (,$(filter $(DEB_HOST_ARCH), armel mipsel m68k powerpc riscv64 sh4))
  export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
endif

# git clone https://github.com/arvidn/try_signal.git deps/try_signal
# cd deps/try_signal
# rm .*
# git clone https://github.com/arvidn/libsimulator.git simulation/libsimulator
# cd simulation/libsimulator
# rm .*

%:
	dh $@ -Scmake+ninja

override_dh_auto_configure:
	dh_auto_configure -- \
	-Dpython-bindings=ON \
	-Dpython-egg-info=ON \
	-Dpython-install-system-dir=ON

#	exit 1

override_dh_auto_build-arch:
	dh_auto_build -- \
	-d explain -d keepdepfile -d keeprsp

override_dh_auto_build-indep:
	make -C docs

override_dh_clean:
	make clean -C docs

	dh_clean tags docs/*.html \
	docs/include/libtorrent/*.hpp docs/plain_text_out.txt \
	docs/*.png docs/favicon.ico docs/settings-ref.rst \
	docs/hunspell/settings.dic docs/single-page-ref.rst

override_dh_auto_install-indep:
override_dh_auto_test:
override_dh_dwz:
