#!/usr/bin/make -f export DH_VERBOSE=1 include /usr/share/mpi-default-dev/debian_defaults DEB_TARGET_ARCH ?= $(shell dpkg-architecture -qDEB_TARGET_ARCH) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) VERSION:=$(shell dpkg-parsechangelog --show-field Version) LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH) DESTDIR:=$(CURDIR)/debian/tmp AUTOGENERATED := $(patsubst %.in,%,$(wildcard debian/*.in)) %: %.in sed -e 's%@DEB_HOST_MULTIARCH@%${DEB_HOST_MULTIARCH}%g' < $< | \ sed -e 's%@VERSION@%${VERSION}%g' | \ sed -e 's%@GFORTRAN_VERSION@%${GFORTRAN_VERSION}%g' > $@ # Set default f95 compiler F95 ?= /usr/bin/f95 GFORTRAN_VERSION:=$(readlink /usr/bin/gfortran) # The magic debhelper rule %: dh $@ --buildsystem=cmake --no-parallel # 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: $(AUTOGENERATED) ifneq (,$(filter $(DEB_TARGET_ARCH),$(MPICH_AVAILABLE_ARCHITECTURES))) CXX=mpicxx.mpich CC=mpicc.mpich FC=mpif90.mpich \ dh_auto_configure --builddirectory=build-mpich -- \ -DCAF_LIB_NAME=caf_mpich endif ifneq (,$(filter $(DEB_TARGET_ARCH),$(OPENMPI_AVAILABLE_ARCHITECTURES))) CXX=mpicxx.openmpi CC=mpicc.openmpi FC=mpif90.openmpi \ dh_auto_configure --builddirectory=build-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 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