#!/usr/bin/make -f

# The source package bundles three separate CPAN distributions, each with its
# own Makefile.PL.  debhelper can only drive one build system per directory,
# so every dh_auto_* step is run once per component.
COMPONENTS := Image-Base Image-Xpm Image-Xbm

# Image::Xpm and Image::Xbm need Image::Base at configure and test time.
# blib/lib is used once Image-Base has been built; lib is the fallback for the
# configure step, which runs before anything has been built.
export PERL5LIB = $(CURDIR)/Image-Base/blib/lib:$(CURDIR)/Image-Base/lib

%:
	dh $@

override_dh_auto_configure:
	set -e; for component in $(COMPONENTS); do \
		dh_auto_configure --sourcedir=$$component; \
	done

override_dh_auto_build:
	set -e; for component in $(COMPONENTS); do \
		dh_auto_build --sourcedir=$$component; \
	done

override_dh_auto_test:
	set -e; for component in $(COMPONENTS); do \
		dh_auto_test --sourcedir=$$component; \
	done

override_dh_auto_install:
	set -e; for component in $(COMPONENTS); do \
		dh_auto_install --sourcedir=$$component; \
	done

override_dh_auto_clean:
	set -e; for component in $(COMPONENTS); do \
		dh_auto_clean --sourcedir=$$component; \
	done
