summaryrefslogtreecommitdiff
path: root/packages/development/openblas/openblas.mk
blob: 958124c81b058266bcb8145d15217a921f3fcf43 (plain)
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
################################################################################
# Embtoolkit
# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# \file         openblas.mk
# \brief        openblas.mk of Embtoolkit.
# \author       Ricardo Crudo <ricardo.crudo@gmail.com>
# \date         May 2014
################################################################################

OPENBLAS_NAME		:= openblas
OPENBLAS_GIT_SITE	:= git://github.com/xianyi/OpenBLAS
OPENBLAS_SRC_DIR	:= $(call __embtk_pkg_srcdir,openblas)
OPENBLAS_BUILD_DIR	:= $(OPENBLAS_SRC_DIR)

OPENBLAS_LIBS		:= libopenblas*
OPENBLAS_INCLUDE	:= cblas.h f77blas.h lapacke_config.h lapacke.h
OPENBLAS_INCLUDE	+= lapacke_mangling.h lapacke_utils.h openblas_config.h

OPENBLAS_MAKE_OPTS	:= PREFIX=/usr AR=$(TARGETAR) RANLIB=$(TARGETRANLIB)
OPENBLAS_MAKE_OPTS	+= LD=$(TARGETLD) NM=$(TARGETNM)
OPENBLAS_MAKE_ENV	:= CC=$(TARGETGCC_CACHED) FC=$(TARGETFC)
OPENBLAS_MAKE_ENV	+= HOSTCC=$(HOSTCC_CACHED)

pembtk_openblas_target	:= GENERIC

ifeq (yy,$(CONFIG_EMBTK_ARCH_ARM_FAMILY_ARM11)$(CONFIG_EMBTK_HARDFLOAT))
pembtk_openblas_target	:= ARMV6
pembtk_openblas_armfpu	:= $(GCC_WITH_FPU-y)
endif
ifeq (yy,$(CONFIG_EMBTK_ARCH_ARM_FAMILY_CORTEX)$(CONFIG_EMBTK_HARDFLOAT))
pembtk_openblas_target	:= ARMV7
pembtk_openblas_armfpu	:= $(GCC_WITH_FPU-y)
endif
OPENBLAS_MAKE_ENV	+= $(if $(CONFIG_EMBTK_64BITS_FS),BINARY=64)
OPENBLAS_MAKE_ENV	+= TARGET=$(pembtk_openblas_target)


define embtk_beforeinstall_openblas
	$(if $(pembtk_openblas_armfpu),
	cp $(OPENBLAS_SRC_DIR)/Makefile.arm $(OPENBLAS_SRC_DIR)/Makefile.arm.bak
	sed -e 's/-mfpu=[[:alnum:]]*/-mfpu=$(pembtk_openblas_armfpu)/g'		\
		< $(OPENBLAS_SRC_DIR)/Makefile.arm				\
		> $(OPENBLAS_SRC_DIR)/Makefile.arm.new
	cp $(OPENBLAS_SRC_DIR)/Makefile.arm.new $(OPENBLAS_SRC_DIR)/Makefile.arm)
endef

define embtk_install_openblas
	$(embtk_beforeinstall_openblas)
        $(call embtk_makeinstall_pkg,openblas)
endef