#!/usr/bin/make -f

%:
	dh $@

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  test := true
else
  test := false
endif

override_dh_auto_configure:
	dh_auto_configure -- -DGLM_TEST_ENABLE=$(test)

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
execute_after_dh_auto_build:
	cd doc && doxygen man.doxy
	printf '<link rel="stylesheet" href="/usr/share/javascript/highlight.js/styles/default.css">\n<script src="/usr/share/javascript/highlight.js/highlight.min.js"></script>\n<script>hljs.initHighlightingOnLoad();</script>\n' > manual.html
	cmark --unsafe manual.md >> manual.html
endif

execute_after_dh_auto_install:
	iconv -f WINDOWS-1252 -t UTF-8 -o \
		debian/tmp/usr/include/glm/gtx/matrix_factorisation.inl \
		debian/tmp/usr/include/glm/gtx/matrix_factorisation.inl

execute_after_dh_install:
	sed -i 's|./doc/manual/|./|g' debian/libglm-doc/usr/share/doc/libglm-doc/manual/manual.html

execute_after_dh_auto_clean:
	$(RM) -r doc/html/ manual.html
