#!/usr/bin/make -f
# -*- makefile -*-

-include /usr/share/dpkg/buildflags.mk

CFLAGS += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)

export CFLAGS CXXFLAGS LDFLAGS

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DLIB_SUFFIX="" -DSKIP_TESTS=TRUE -DPLUGIN_XROOTD=FALSE -DSYSCONF_INSTALL_DIR=/etc/ -DPLUGIN_MOCK=TRUE

override_dh_auto_build:
	dh_auto_build -- all doc

override_dh_install:
	mkdir -p debian/gfal2-doc/usr/share/doc/gfal2-doc
	mv debian/tmp/usr/share/doc/gfal2/examples \
	   debian/tmp/usr/share/doc/gfal2/html \
	   debian/gfal2-doc/usr/share/doc/gfal2-doc
	rm -rf debian/tmp/usr/share/doc
	dh_install --fail-missing

override_dh_auto_clean:
	dh_auto_clean

override_dh_auto_test:
	objdir=`ls -d obj-*` ; \
	export GFAL_PLUGIN_DIR=$(CURDIR)/$${objdir}/plugins ; \
	export GFAL_CONFIG_DIR=$(CURDIR)/$${objdir}/test/conf_test ; \
	dh_auto_test -- "ARGS+=-V"
