#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --builddirectory=build

override_dh_auto_clean:
	rm -f *.1
	dh_auto_clean --

override_dh_install:
	dh_install
	find debian -name "LICENSE*.rst" -delete

override_dh_installman:
	./build/bin/lambda --export-help man \
	  | sed -r 's/(number of threads.*) Default:.*/\1/g' \
	  | sed -r 's/\(Git commit +\)//g' > lambda.1
	./build/bin/lambda_indexer --export-help man \
	  | sed -r 's/(number of threads.*) Default:.*/\1/g' \
	  | sed -r 's/(defaults to working directory.*) Default:.*/\1/g' \
	  | sed -r 's/\(Git commit +\)//g' > lambda_indexer.1
	dh_installman --

override_dh_auto_configure:
	dh_auto_configure -- -DLAMBDA_NATIVE_BUILD=OFF -DLAMBDA_MMAPPED_DB=ON -DCMAKE_BUILD_TYPE=Release
