#!/usr/bin/make -f
export DH_VERBOSE = 0
%:
	dh $@ --buildsystem=cmake  --builddirectory=build

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
				 -DCMAKE_BUILD_TYPE=Release \
				 -DLLVM_PARALLEL_LINK_JOBS=1 \
				 -DLLVM_USE_LINKER=lld \
				 -DHLSL_OFFICIAL_BUILD=ON \
			     -C../cmake/caches/PredefinedParams.cmake

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# running check-llvm and not check-all, because check-all needs some locales set up
	# check-all is run in the autopkg test.
	cd build && make check-llvm
endif

override_dh_auto_build:
	dh_auto_build
	help2man --no-discard-stderr --name="DirectX Shader Compiler" build/bin/dxc > dxc.1

override_dh_install:
	dh_install
	rm -v debian/dxc-dev/usr/lib/dxc/libLLVMDxilHash.a
	rm -v debian/dxc-dev/usr/lib/dxc/libLLVMDxilValidation.a
	rm -v debian/dxc-dev/usr/lib/dxc/libdxcvalidator.a
