#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=optimize=-lto
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115824
export CXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS) -Wno-array-bounds -Wno-stringop-overread

%:
	dh $@ 

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_BUILD_TYPE=Release \
		-DSPIRV-Headers_SOURCE_DIR=/usr \
		-DBUILD_SHARED_LIBS=OFF \
		-DSPIRV_TOOLS_BUILD_STATIC=ON \
		-DSPIRV_TOOLS_LIBRARY_TYPE=STATIC

override_dh_auto_test:

override_dh_install:
	dh_install


gentarball: SOURCE=spirv-tools
gentarball: UV=$(shell dpkg-parsechangelog|awk '/^Version:/ {print $$2}'|sed 's/-.*$$//')
gentarball:
	git archive --format=tar upstream-unstable --prefix=$(SOURCE)-$(UV)/ | gzip -9 > \
		../$(SOURCE)_$(UV).orig.tar.gz

