#!/usr/bin/make -f

ifneq "$(DEB_BUILD_ARCH)" "amd64"
        CONFIG_ASM = --disable-asm
endif

export NASMENV=-w-macro-params-legacy

export DEB_CFLAGS_MAINT_APPEND = -Wno-incompatible-pointer-types

%:
	dh $@ -Dbuild/linux --with autoreconf,quilt

override_dh_auto_configure:
	cp /usr/share/automake-*/config.guess  build/linux

	dh_auto_configure -- \
	--bit-depth=8 \
        --chroma-format=all \
	--enable-pic \
	--enable-shared \
	--system-libxavs2 \
	--host=$(DEB_HOST_GNU_TYPE) \
	$(CONFIG_ASM)

#	exit 1

override_dh_install:
	dh_install

	d-shlibmove --commit \
	--devunversioned \
	--exclude-la \
	--multiarch \
	--movedev "debian/tmp/usr/include/*" usr/include/ \
	--movedev "debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/*" \
	usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
	debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.so

override_dh_clean:
	dh_clean build/linux/common/vec/*.o source/version.h \
	build/linux/common/x86/*.o

override_dh_auto_clean:
#	cd build/linux && ./configure --host=$(DEB_HOST_GNU_TYPE) --disable-asm
#	cd build/linux && $(MAKE) distclean
