#!/usr/bin/make -f

# Don't override the upstream FLAG -O3
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS 2>/dev/null | sed -e 's/-O2//g')

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CXXFLAGS_MAINT_APPEND = -std=c++14

%:
	dh $@ --with python3

override_dh_auto_build:
	mkdir -p $(CURDIR)/obj/
	mkdir -p $(CURDIR)/bin/
	dh_auto_build -- CXXFLAGS='$(CXXFLAGS)'
	cd $(CURDIR)/example/ && \
		tar Jcvf examples.tar.xz * --sort=name --mode=go=rX,u+rw,a-s --owner=root --group=root --numeric-owner

execute_after_dh_fixperms-arch:
	chmod -x debian/*/usr/share/fastqtl/*.R