#!/usr/bin/make -f export DH_VERBOSE=1 include /usr/share/mpi-default-dev/debian_defaults include /usr/share/dpkg/architecture.mk DEB_TARGET_ARCH ?= $(shell dpkg-architecture -qDEB_TARGET_ARCH) VERSION:=$(shell dpkg-parsechangelog --show-field Version) LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH) DESTDIR:=$(CURDIR)/debian/tmp # Set default f95 compiler F95 ?= /usr/bin/f95 GFORTRAN_VERSION:=$(readlink /usr/bin/gfortran) # The magic debhelper rule %: dh $@ --buildsystem=cmake --no-parallel AUTOGENERATED:= caf.mpich caf.openmpi \ libcoarrays-mpich-dev.prerm libcoarrays-openmpi-dev.prerm \ caf-mpich.pc caf-openmpi.pc \ libcoarrays-mpich-dev.postinst libcoarrays-openmpi-dev.postinst # DISABLED_TESTS:= "powerpc alpha" MPICH_CFLAGS=$(dpkg-buildpackage --get CFLAGS) $(shell pkg-config mpich --cflags) MPICH_FCFLAGS=$(dpkg-buildpackage --get FCFLAGS) $(shell pkg-config mpich-fort --cflags) OPENMPI_CFLAGS=$(dpkg-buildpackage --get CFLAGS) $(shell pkg-config ompi-c --cflags) OPENMPI_FCFLAGS=$(dpkg-buildpackage --get FCFLAGS) $(shell pkg-config ompi-fort --cflags) override_dh_auto_configure: for f in ${AUTOGENERATED} ; do \ sed -e 's%@DEB_HOST_MULTIARCH@%${DEB_HOST_MULTIARCH}%g' < debian/$$f.in | \ sed -e 's%@VERSION@%${VERSION}%g' | \ sed -e 's%@GFORTRAN_VERSION@%${GFORTRAN_VERSION}%g' > debian/$$f ; \ done ifneq (,$(filter $(DEB_TARGET_ARCH),$(MPICH_AVAILABLE_ARCHITECTURES))) dh_auto_configure --builddirectory=build-mpich -- \ -DCAF_LIB_NAME=caf_mpich \ -DMPIEXEC_EXECUTABLE=/usr/bin/mpiexec.mpich endif ifneq (,$(filter $(DEB_TARGET_ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) dh_auto_configure --builddirectory=build-openmpi -- \ -DMPIEXEC_EXECUTABLE=/usr/bin/mpiexec.openmpi \ -DCAF_LIB_NAME=caf_openmpi endif override_dh_auto_build: ifneq (,$(filter $(DEB_TARGET_ARCH),$(MPICH_AVAILABLE_ARCHITECTURES))) dh_auto_build --builddirectory=build-mpich endif ifneq (,$(filter $(DEB_TARGET_ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) dh_auto_build --builddirectory=build-openmpi endif override_dh_auto_install: ifneq (,$(filter $(DEB_TARGET_ARCH),$(MPICH_AVAILABLE_ARCHITECTURES))) cp debian/caf.mpich build-mpich/bin/caf dh_auto_install --builddirectory=build-mpich mkdir -p $(DESTDIR)/$(LIBDIR)/open-coarrays/mpich/lib mv build-mpich/lib/$(DEB_HOST_MULTIARCH)/libopencoarrays_mod.a $(DESTDIR)/$(LIBDIR)/open-coarrays/mpich/lib/libopencoarrays_mod_mpich.a endif ifneq (,$(filter $(DEB_TARGET_ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) cp debian/caf.openmpi build-openmpi/bin/caf dh_auto_install --builddirectory=build-openmpi mkdir -p $(DESTDIR)/$(LIBDIR)/open-coarrays/openmpi/lib/ mv build-openmpi/lib/$(DEB_HOST_MULTIARCH)/libopencoarrays_mod.a $(DESTDIR)/$(LIBDIR)/open-coarrays/openmpi/lib/libopencoarrays_mod_openmpi.a endif rm $(DESTDIR)/$(LIBDIR)/libopencoarrays_mod.a override_dh_auto_clean: dh_clean rm -f $(patsubst %, debian/%, ${AUTOGENERATED}) rm -rf build-* @echo "Generating the control file..." echo "# DON'T MANUALLY MODIFY!" > debian/control.tmp echo "# EDIT debian/control.in INSTEAD!" >> debian/control.tmp echo "#" >> debian/control.tmp cat debian/control.in >> debian/control.tmp sed -i "s,%SUPPORTED_ARCHITECTURES%,$(strip $(sort $(OPENMPI_ARCHITECTURES) $(MPICH_ARCHITECTURES))),g" debian/control.tmp sed -i "s,%OPENMPI_ARCHITECTURES%,$(strip $(sort $(OPENMPI_AVAILABLE_ARCHITECTURES))),g" debian/control.tmp sed -i "s,%MPICH_ARCHITECTURES%,$(strip $(sort $(MPICH_AVAILABLE_ARCHITECTURES))),g" debian/control.tmp sed -i "s,powerpcspe ,,g" debian/control.tmp set -e ; if ! diff -q debian/control debian/control.tmp > /dev/null; then \ echo ;\ echo "The generated control file differs from the actual one." ;\ echo "A sourceful upload of this package is needed." ;\ echo ;\ echo "Differences:" ;\ diff -u debian/control debian/control.tmp ;\ else \ rm debian/control.tmp ;\ fi override_dh_auto_test: ifneq (,$(findstring "$(DEB_TARGET_ARCH)",$(DISABLED_TESTS))) @echo "Tests disabled on this arch: known failures being investigated" else @echo "Tests may hang/timeout due to lack of processors. " -dh_auto_test --timeout 30 endif