if [ $# -ne 1 ];
then
echo "$0 /path/to/ndk/"
echo "e.g. $0 ~/Library/Android/sdk/ndk/21.4.7075529/"
exit
fi
export NDK=$1
echo "NDK path: $NDK"
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
echo "TOOLCHAIN path: $TOOLCHAIN"
installDir=./installOpenBlas
rm -rf ${installDir}
echo "remove last time ${installDir}"
# target 请看下面网址
# https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
for target in ARMV7 ARMV8 CORTEXA53
do
make clean
echo "make target=$target"
if [ $target = ARMV7 ]
then
strCC="$TOOLCHAIN"/bin/armv7a-linux-androideabi21-clang
strAR="$TOOLCHAIN"/bin/arm-linux-androideabi-ar
else
strCC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
strAR=$TOOLCHAIN/bin/aarch64-linux-android-ar
fi
make TARGET=$target USE_THREAD=0 NOFORTRAN=1 ONLY_CBLAS=1 CC="$strCC" AR="$strAR" HOSTCC=gcc ARM_SOFTFP_ABI=1 -j4
echo "make install target=$target"
make PREFIX=${installDir}/${target} install
done
echo "Done! libs in `pwd`$installDir"