#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

CMAKE_OPTS += -DFMT_DOC=off
CMAKE_OPTS += -DFMT_PEDANTIC=on
CMAKE_OPTS += -DCMAKE_POSITION_INDEPENDENT_CODE=on
CMAKE_OPTS += -DBUILD_SHARED_LIBS=on
CMAKE_OPTS += -DCMAKE_CXX_STANDARD=11
ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	CMAKE_OPTS += -DFMT_TEST=off
endif

%:
	dh $@ -B bdir

override_dh_auto_configure-arch:
	dh_auto_configure -- $(CMAKE_OPTS)

override_dh_auto_configure-indep:

override_dh_auto_build-indep:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR)/support/python mkdocs build -f ./support/mkdocs.yml \
		--no-directory-urls -t mkdocs -d $(CURDIR)/bdir/libfmt-doc/
endif

override_dh_auto_test-indep:

override_dh_auto_install-indep:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	mkdir -p debian/tmp/usr/share/doc
	cp -vr bdir/libfmt-doc debian/tmp/usr/share/doc/
endif
