2
2
# Copyright 2008-2010 Sylvestre Ledru <sylvestre@debian.org>
4
4
include /usr/share/cdbs/1/rules/debhelper.mk
5
include /usr/share/cdbs/1/rules/simple-patchsys.mk
7
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
8
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
10
# Pointer bitwidth (default value)
13
# 0 means Unknown CPU. Leave Atlas find out
14
# 1 means no extension
6
# NB: the following numbers come from xprint_enums (compilable from the build
7
# directory with "make xprint_enums); they can change across major releases
9
# First number in ARCHS:
10
# - 0 means Unknown CPU: leave ATLAS find out; used for archs where a more specific choice is not available
11
# - 8 means IBMz9: for s390 and s390x
12
# - 1 means POWER3: most generic PowerPC (#680096); cannot be used on powerpcspe (#701068)
13
# - 11 means artificial architecture called x86x87, providing you with portable (but slow!) architectural defaults: for *i386
14
# See http://math-atlas.sourceforge.net/atlas_install/node28.html
15
# - 13 means generic libraries for P4 and later, with SSE2: for *amd64
16
# See: http://math-atlas.sourceforge.net/atlas_install/node30.html
17
# - 36 means IA64Itan: for ia64
18
# - 38 means UltraSparc I (USI): for sparc
19
# - 46 means ARMv7: for armhf (but not for armel, which is ARM >= v4)
20
# Second number in ARCHS:
21
# - 1 means no instruction set extension
22
# - 384 means SSE1+SSE2 (always available on amd64)
23
ifneq (,$(findstring $(DEB_HOST_ARCH),s390 s390x))
25
else ifeq ($(DEB_HOST_ARCH_CPU),i386)
27
else ifeq ($(DEB_HOST_ARCH_CPU),amd64)
29
else ifeq ($(DEB_HOST_ARCH),ia64)
31
else ifeq ($(DEB_HOST_ARCH),sparc)
33
else ifeq ($(DEB_HOST_ARCH),armhf)
35
else ifneq (,$(findstring $(DEB_HOST_ARCH),powerpc ppc64))
42
MODE_BITWIDTH = $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)
16
44
DEB_SHLIBDEPS_INCLUDE_libatlas3-base := $(CURDIR)/debian/libatlas3-base/usr/lib/atlas-base/:$(CURDIR)/debian/libatlas3-base/usr/lib/atlas-base/atlas/
18
# # see what do we do with the amd64 / intel 64
19
ifeq ($(DEB_HOST_ARCH_CPU),amd64)
24
ifeq ($(DEB_HOST_ARCH_CPU),ia64)
28
ifeq ($(DEB_HOST_ARCH_CPU),ppc64)
33
GFORTRAN_LIB_PATH=`gcc -print-search-dirs|grep ^install:|awk '{print $$2}'`
46
DEB_DH_GENCONTROL_ARGS_ALL := -- -VBuilt-Using="`dpkg-query -W -f='$${source:Package} (= $${source:Version})' liblapack-pic`"
48
GFORTRAN_LIB_PATH=`$(CC) -print-search-dirs|grep ^install:|awk '{print $$2}'`
35
50
COMMON_CONFIG_PARAMS := --prefix="$(DEB_DESTDIR)" \
36
51
--incdir="$(DEB_DESTDIR)/usr/include/" \
39
54
--cflags="${CFLAGS}" \
41
56
-b $(MODE_BITWIDTH) \
42
-Fa alg '-Wa,--noexecstack -fPIC' \
43
58
-Ss f77lib "-L$(GFORTRAN_LIB_PATH) -lgfortran -lgcc_s -lpthread" \
44
59
-Ss pmake '$(MAKE)' \
45
--with-netlib-lapack=/usr/lib/liblapack_pic.a \
60
-Ss flapack /usr/lib/liblapack_pic.a \
49
# ../../configure --cc="cc" --cflags="-g -O2" -D c -DWALL -b 64 -Fa alg '-Wa,--noexecstack -fPIC' -Ss flapack /usr/lib/liblapack_pic.a -Ss f77lib "-L/usr/lib/gcc/x86_64-linux-gnu/4.4.5/ -lgfortran -lgcc_s -lpthread" -Ss pmake '/usr/bin/make -j 1' -A 0 -V 1 -v 2 -Si cputhrchk 0 -t 2
65
# See http://math-atlas.sourceforge.net/errata.html#armhardfp
66
ifeq ($(DEB_HOST_ARCH),armhf)
67
COMMON_CONFIG_PARAMS += -D c -DATL_ARM_HARDFP=1
70
# The archdefs provided by ATLAS are unsuitable for armhf (see details in
73
# Hence we replace them by new ones without the problematic flags. They are
74
# located under debian/archdefs/arm, and used for the generic package.
76
# The following rules ensure that these new archdefs are also used for the
79
test -f CONFIG/ARCHS/ARMv732.tar.bz2.old || (mv CONFIG/ARCHS/ARMv732.tar.bz2 CONFIG/ARCHS/ARMv732.tar.bz2.old && cp debian/archdefs/arm/ARMv732.tar.bz2 CONFIG/ARCHS/ARMv732.tar.bz2)
80
test -f CONFIG/ARCHS/ARMv732NEON.tar.bz2.old || (mv CONFIG/ARCHS/ARMv732NEON.tar.bz2 CONFIG/ARCHS/ARMv732NEON.tar.bz2.old && cp debian/archdefs/arm/ARMv732NEON.tar.bz2 CONFIG/ARCHS/ARMv732NEON.tar.bz2)
82
restore-armhf-archdef:
83
(test -f CONFIG/ARCHS/ARMv732.tar.bz2.old && mv CONFIG/ARCHS/ARMv732.tar.bz2.old CONFIG/ARCHS/ARMv732.tar.bz2) || true
84
(test -f CONFIG/ARCHS/ARMv732NEON.tar.bz2.old && mv CONFIG/ARCHS/ARMv732NEON.tar.bz2.old CONFIG/ARCHS/ARMv732NEON.tar.bz2) || true
86
# Build a custom package optimized for the current arch
50
87
custom: custom-stamp
52
# Build a custom package optimized for the current arch
89
custom-stamp: use-my-armhf-archdef
54
90
rm -f configure-stamp
56
92
ncpu=$$(LANG=C cpufreq-info | grep "analyzing CPU" -c);\
91
128
atlasISA=`echo $(ARCHS)|sed -e "s|.*_.*_\(.*\)|\1|g"`; \
92
129
mkdir -p build/$$targetName; \
93
130
cd build/$$targetName; \
94
../../configure $(COMMON_CONFIG_PARAMS); \
131
if test "$(ARCHS)" != "base__"; then \
132
../../configure $(COMMON_CONFIG_PARAMS) -t 0 -Ss ADdir ../../../debian/archdefs/$(DEB_HOST_ARCH_CPU); \
134
../../configure $(COMMON_CONFIG_PARAMS); \
95
136
echo "Configure done. targetName = $$targetName / atlasArch = $$atlasArch / atlasISA = $$atlasISA"; \
96
137
if test ! -s Make.inc; then echo "Configure failed: Make.inc not found"; exit 1; fi; \
97
138
cat Make.inc |grep ARCH|head -1|awk '{print $$3}'; \
103
build: build-arch build-indep
105
build-indep: build-indep-stamp
106
build-indep-stamp: configure-stamp
109
build-arch: build-arch-stamp
110
build-arch-stamp: configure-stamp
143
common-build-arch common-build-indep:: build-stamp
113
147
targetName=`echo $(ARCHS)|sed -e "s|\(.*\)_.*_.*|atlas-\1|g"`; \
114
148
cd build/$$targetName; \
151
test -f build/$$targetName/lib/libptcblas.a && $(MAKE) ptcheck; \
122
152
echo "=============================================="; \
124
154
# Do not build the help when building the custom package
130
clean:: clean-work #unpatch
161
clean-work: restore-armhf-archdef
134
164
rm -rf build check
135
rm -f build-arch-stamp build-indep-stamp
136
rm -f install-arch-stamp install-indep-stamp configure-stamp
165
rm -f configure-stamp build-stamp
138
167
[ ! -f Makefile ] || $(MAKE) distclean
139
# some additional cleanups
143
install: install-arch install-indep
145
install-indep: configure build install-indep-stamp
151
install-arch: configure build install-arch-stamp
170
common-install-arch common-install-indep::
175
193
cp -R $(CURDIR)/doc/* $(CURDIR)/TexDoc/*.pdf $(CURDIR)/debian/libatlas-doc/usr/share/doc/libatlas-doc/; \
178
binary: binary-indep binary-arch
180
binary-indep: build install
183
dh_installchangelogs -i
184
# dh_installexamples -patlas-doc examples/*
188
dh_compress -i -X.pdf
192
dh_shlibdeps -i -l $$(pwd)
198
binary-arch: build install
201
dh_installchangelogs -a
202
dh_installexamples -a
209
.PHONY: build build-indep build-indep-stamp build-arch build-arch-stamp check clean binary binary-indep binary-arch configure-stamp configure custom custom-stamp
196
# We want packages using libblas/liblapack to depend on any BLAS/LAPACK
197
# alternative, and we want packages depending on ATLAS-specific libraries
198
# (e.g. libatlas.so) to depend specifically on libatlas3-base.
200
# Such a setting is not supported by dh_makeshlibs, so we ship a hand-crafted
202
binary-predeb/libatlas3-base::
203
cp debian/libatlas3-base.shlibs debian/libatlas3-base/DEBIAN/shlibs
213
206
-uscan --upstream-version 0