File: rules

package info (click to toggle)
openblas 0.2.19-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 44,272 kB
  • ctags: 76,509
  • sloc: asm: 1,086,998; ansic: 186,055; fortran: 74,181; makefile: 11,187; perl: 3,428; python: 661; sh: 81
file content (111 lines) | stat: -rwxr-xr-x 3,352 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
#!/usr/bin/make -f

include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

MAKE_OPTIONS := NO_LAPACKE=1 NO_AFFINITY=1 NO_WARMUP=1 CFLAGS="$(CPPFLAGS) $(CFLAGS)" FFLAGS="$(FFLAGS)"

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	MAKE_OPTIONS += DEBUG=1
endif

# Build generic package with hardcoded max number of threads of 64
GENERIC_OPTIONS := NUM_THREADS=64

# On x86 archs, enable dynamic arch selection
ENABLE_DYNAMIC_ARCHS := amd64 i386 kfreebsd-amd64 kfreebsd-i386
ifneq (,$(findstring $(DEB_HOST_ARCH),$(ENABLE_DYNAMIC_ARCHS)))
	GENERIC_OPTIONS += DYNAMIC_ARCH=1
endif

# We cannot use the ARMv7 profile on armhf, because it requires a 32-register FP unit.
# See kernel/arm/KERNEL.ARMv7: it loads some *_vfpv3.S files, which use 32 registers.
# Also, it FTBFS if GCC flag -mvfpv3 is removed (see arm-gcc-flags.patch), because GCC
# refuses asm files with 32 FP registers in that case.
# Issue discussed in https://github.com/xianyi/OpenBLAS/issues/388
# See also debian/patches/arm-gcc-flags.patch which is related.
ifeq ($(DEB_HOST_ARCH),armhf)
	GENERIC_OPTIONS += TARGET=ARMV6
endif

ifeq ($(DEB_HOST_ARCH),arm64)
	GENERIC_OPTIONS += TARGET=ARMV8
endif

# There is no dynamic arch selection on PowerPC. To avoid selecting a
# target based on the buildd hardware, we enforce a generic-enough
# target.
ifeq ($(DEB_HOST_ARCH),powerpc)
	GENERIC_OPTIONS += TARGET=PPCG4
endif

# Same for mips64el
ifeq ($(DEB_HOST_ARCH),mips64el)
	GENERIC_OPTIONS += TARGET=SICORTEX
endif

ifeq ($(DEB_HOST_ARCH),ppc64el)
	GENERIC_OPTIONS += TARGET=POWER8
endif

# The testsuite crashes on PowerPC. Disable it by pretending we are
# cross-compiling.
ifeq ($(DEB_HOST_ARCH),powerpc)
	GENERIC_OPTIONS += CROSS=1
endif


ifeq ($(TARGET),)
	# Generic package
	MAKE_OPTIONS += $(GENERIC_OPTIONS)
else ifeq ($(TARGET),custom)
	# Custom package, leave the arch detection to OpenBLAS
else
	# Use the TARGET value provided by the user
	MAKE_OPTIONS += TARGET=$(TARGET)
endif


%:
	dh $@

debian/blas-openblas.pc: debian/blas-openblas.pc.in
	sed -e "s%@DEB_VERSION_UPSTREAM@%$(DEB_VERSION_UPSTREAM)%" < $< > $@

debian/lapack-openblas.pc: debian/lapack-openblas.pc.in
	sed -e "s%@DEB_VERSION_UPSTREAM@%$(DEB_VERSION_UPSTREAM)%" < $< > $@

override_dh_auto_build: debian/blas-openblas.pc debian/lapack-openblas.pc
	$(MAKE) $(MAKE_OPTIONS)

	$(MAKE) -C interface shared-blas-lapack $(MAKE_OPTIONS)

override_dh_auto_install:
	$(MAKE) install $(MAKE_OPTIONS) DESTDIR=debian/tmp/ PREFIX=/usr

override_dh_auto_clean:
	dh_auto_clean
	rm -f debian/*.pc

custom:
	dch --local='+custom'  "custom build on: `uname -a`"
	LANG=C DEB_CFLAGS_MAINT_APPEND="-march=native -mtune=native" debian/rules TARGET=custom build binary

# We want packages linked with -lblas to depend on any BLAS alternative, and we
# want packages linked with -lopenblas to depend specifically on
# libopenblas-base.
#
# Such a setting is not supported by dh_makeshlibs, so we ship a hand-crafted
# shlibs file.
override_dh_makeshlibs:
	dh_makeshlibs
	cp debian/libopenblas-base.shlibs debian/libopenblas-base/DEBIAN/shlibs

override_dh_gencontrol:
	dh_gencontrol -- -VBuilt-Using="`dpkg-query -W -f='$${source:Package} (= $${source:Version})' liblapack-pic`"

override_dh_strip:
	dh_strip --dbgsym-migration='libopenblas-dbg (<< 0.2.16-1~)'

get-orig-source:
	-uscan --upstream-version 0