File: rules

package info (click to toggle)
open-coarrays 2.10.2%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,712 kB
  • sloc: ansic: 11,788; f90: 11,161; sh: 3,745; makefile: 81
file content (101 lines) | stat: -rwxr-xr-x 3,972 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/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