blob: ea3d198c48d69a94346dd879b75bf0bdbfb95f6d [file] [log] [blame]
flimc91ee5b2016-01-26 14:33:44 +01001#!/bin/bash
2
3set -e
4ASM_CONVERTER="./celt/arm/arm2gnu.pl"
5
6if [[ ! -x "${ASM_CONVERTER}" ]]; then
7 echo "This script should be run from external/libopus."
8 exit
9fi
10
11while read file; do
12 # This check is required because the ASM conversion script doesn't seem to be
13 # idempotent.
14 if [[ ! "${file}" =~ .*_gnu\.s$ ]]; then
15 gnu_file="${file%.s}_gnu.s"
16 ${ASM_CONVERTER} "${file}" > "${gnu_file}"
17 # The ASM conversion script replaces includes with *_gnu.S. So, replace
18 # occurences of "*-gnu.S" with "*_gnu.s".
19 sed -i "s/-gnu\.S/_gnu\.s/g" "${gnu_file}"
20 rm -f "${file}"
21 fi
22done < <(find . -iname '*.s')
23
24# Generate armopts.s from armopts.s.in
25sed \
26 -e "s/@OPUS_ARM_MAY_HAVE_EDSP@/1/g" \
27 -e "s/@OPUS_ARM_MAY_HAVE_MEDIA@/1/g" \
28 -e "s/@OPUS_ARM_MAY_HAVE_NEON@/1/g" \
29 -e "s/@OPUS_ARM_MAY_HAVE_NEON_INTR@/1/g" \
30 celt/arm/armopts.s.in > celt/arm/armopts.s.temp
31${ASM_CONVERTER} "celt/arm/armopts.s.temp" > "celt/arm/armopts_gnu.s"
32rm "celt/arm/armopts.s.temp"
33echo "Converted all ASM files and generated armopts.s successfully."