~ubuntu-branches/ubuntu/trusty/openblas/trusty

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
#!/usr/bin/make -f
# Sylvestre Ledru <sylvestre@debian.org>

include /usr/share/cdbs/1/rules/debhelper.mk

DEB_DH_MAKESHLIBS_ARGS_libopenblas-base = -V "libblas3 | libblas.so.3"

COMMON_MAKE_OPTIONS = NO_LAPACK=1 NO_AFFINITY=1 NO_WARMUP=1
ENABLE_DYNAMIC_ARCHS := amd64 i386 kfreebsd-amd64 kfreebsd-i386
ifneq (,$(findstring $(DEB_HOST_ARCH),$(ENABLE_DYNAMIC_ARCHS)))
	DYNAMIC_ARCH_ARG="DYNAMIC_ARCH=1"
	TARGET_GENERIC_ARG="TARGET=GENERIC"
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	DEBUG_ARG="DEBUG=1"
endif

build: build-arch

build-arch: build-stamp

build-stamp:
	if test "$(TARGET)" = ""; then 		\
			echo "Support multiple architectures"; \
			$(MAKE) $(COMMON_MAKE_OPTIONS) $(DYNAMIC_ARCH_ARG) $(TARGET_GENERIC_ARG) $(DEBUG_ARG) NUM_THREADS=64;		\
	fi

	if test "$(TARGET)" = "custom"; then 		\
			echo "Leave the detection to GotoBLAS / OpenBLAS"; \
			$(MAKE) $(COMMON_MAKE_OPTIONS) $(DEBUG_ARG); 								\
	fi

	if test "$(TARGET)" != "" -a "$(TARGET)" != "custom"; then 		\
			echo "Use the value '$(TARGET)' provided by the user";	\
			$(MAKE) $(COMMON_MAKE_OPTIONS) TARGET=$(TARGET) $(DEBUG_ARG);									\
	fi;

	rm libopenblas.so
	mv libopenblas*-*.so libopenblas.so.0
	ln -s libopenblas.so.0 libopenblas.so
	mv libopenblas*-*.a libopenblas.a
	touch $@

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

clean::
	$(MAKE) clean
	rm -f libopenblas.so.0 libblas.so.3

# 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.
binary-predeb/libopenblas-base::
	cp debian/libopenblas-base.shlibs debian/libopenblas-base/DEBIAN/shlibs

# Build a custom package optimized for the current arch
custom-stamp:

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