File: rules

package info (click to toggle)
magma 2.9.0%2Bds-2
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 83,212 kB
  • sloc: cpp: 709,115; fortran: 121,916; ansic: 32,343; python: 25,603; f90: 15,208; makefile: 942; xml: 253; csh: 232; sh: 203; perl: 104
file content (116 lines) | stat: -rwxr-xr-x 3,356 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/make -f

ifneq (,$(shell command -v nvcc))
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
else ifneq (,$(shell command -v hipcc))
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
export DEB_CXXFLAGS_MAINT_PREPEND = -gz -Wno-pass-failed

# filter incompatible options from affecting device code
CXXFLAGS := $(subst -fstack-protector-strong,-Xarch_host -fstack-protector-strong,$(CXXFLAGS))
CXXFLAGS := $(subst -fcf-protection,-Xarch_host -fcf-protection,$(CXXFLAGS))
endif

# misc configs
ifneq (,$(shell command -v nvcc))
export OPENBLASDIR=/usr
export DESTDIR=$(pwd)/debian/tmp
export prefix=/usr
export CUDADIR=/usr
else ifneq (,$(shell command -v hipcc))
endif

ifneq (,$(shell command -v nvcc))
# CUDA
ifneq (,$(shell which ccache))
export NVCC=ccache nvcc
export CC=ccache cuda-gcc
export CXX=ccache cuda-g++
else
export NVCC=nvcc
export CC=cuda-gcc
export CXX=cuda-g++
endif
else ifneq (,$(shell command -v hipcc))
# HIP
export CXX=hipcc
ifneq (,$(shell which ccache))
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
endif

CMAKE_FLAGS = \
	-DAMDGPU_TARGETS="gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1010;gfx1030;gfx1100;gfx1101;gfx1102" \
	-DBLA_VENDOR=OpenBLAS \
	-DCMAKE_SKIP_RPATH=ON \
	-DMAGMA_ENABLE_HIP=ON
endif

ifneq (,$(shell command -v nvcc))
# CUDA
%:
	dh $@

make.inc:
	cp -v make.inc-examples/make.inc.openblas make.inc
	sed -i -e 's#^\(CC\)\s*=\(.*\)#\1 = $(CC)#' \
		-e 's#^\(CXX\)\s*=\(.*\)#\1 = $(CXX)#' \
		-e 's#^\(NVCC\)\s*=\(.*\)#\1 = $(NVCC)#' \
		-e 's#^\(CFLAGS\)\s*=\(.*\)#\1 = \2 $(CPPFLAGS) $(CFLAGS)#' \
		-e 's#^\(CXXFLAGS\)\s*=\(.*\)#\1 = \2 $(CPPFLAGS) $(CXXFLAGS)#' \
		-e 's#^\(FFLAGS\)\s*=\(.*\)#\1 = \2 $(FFLAGS)#' \
		-e 's#^\(LDLAGS\)\s*=\(.*\)#\1 = \2 $(LDLAGS)#' \
		-e 's#^\(DEVCCFLAGS\)\s*=\(.*\)#\1 = \2 -g -G#' \
		-e 's#-lopenblas#-lblas -llapack#' \
		-e 's@^#\(OPENBLASDIR\)\s*?=.*@\1 ?= /usr@' \
		-e 's@^#\(CUDADIR\)\s*?=.*@\1 ?= /usr@' \
		make.inc

override_dh_auto_configure: make.inc
	cp -v debian/missing-source/*.py tools/
	dh_auto_configure

override_dh_auto_build-arch:
	dh_auto_build

override_dh_auto_build-indep:
	$(MAKE) generate
	cd docs; doxygen Doxyfile
#	find docs -type f -name '*.html' -exec sed -i -e \
#		's@http://cdn.mathjax.org/mathjax/latest/MathJax.js@file:///usr/share/javascript/mathjax/MathJax.js@g' \
#		'{}' \;

override_dh_auto_clean: make.inc
	dh_auto_clean
	-$(RM) make.inc
else ifneq (,$(shell command -v hipcc))
# HIP
%:
	dh $@ -Scmake

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_FLAGS)

override_dh_auto_build-arch:
	dh_auto_build

override_dh_auto_build-indep:
	cd docs; doxygen Doxyfile

# dwz doesn't fully support DWARF-5 yet, see #1016936
override_dh_dwz:
	:
endif

override_dh_auto_install-arch:
	dh_auto_install
	# upstream install target does not install the test binaries
ifneq (,$(shell command -v nvcc))
	for I in $$(find testing -type f -executable -name 'testing_*'); do \
		install -Dm0755 $$I debian/libmagma-test/usr/lib/libmagma-test/$$I; done
else ifneq (,$(shell command -v hipcc))
	for I in $$(find obj-$(DEB_HOST_MULTIARCH)/testing -type f -executable -name 'testing_*' -printf '%P\n'); do \
		install -Dm0755 obj-$(DEB_HOST_MULTIARCH)/testing/$$I debian/libmagma-rocm-test/usr/lib/$(DEB_HOST_MULTIARCH)/libmagma-rocm-test/testing/$$I; done
endif