Use gawk if available, fixes running on OS X if gawk is installed (#4460)
This commit is contained in:
committed by
Bertrand Songis
parent
03125ccad6
commit
fb49d1197d
@@ -63,6 +63,14 @@ for i in "$@" ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# -- prefer gawk to awk if installed
|
||||||
|
which gawk 2>&1 > /dev/null
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
AWKCMD="gawk -nf"
|
||||||
|
else
|
||||||
|
AWKCMD="awk -nf"
|
||||||
|
fi
|
||||||
|
|
||||||
# -- defaults which may change based on MCU
|
# -- defaults which may change based on MCU
|
||||||
default_flash_addr=0x08000000
|
default_flash_addr=0x08000000
|
||||||
default_flash_sz=1024 # KB
|
default_flash_sz=1024 # KB
|
||||||
@@ -154,7 +162,7 @@ for elf in "$@"; do
|
|||||||
fi
|
fi
|
||||||
#${SIZE} -A -x ${elf}
|
#${SIZE} -A -x ${elf}
|
||||||
escelf="${elf//\\//}"
|
escelf="${elf//\\//}"
|
||||||
output=`${SIZE} -A -x ${elf} | "${base_dir}/elf-size-report.awk" \
|
output=`${SIZE} -A -x ${elf} | ${AWKCMD} "${base_dir}/elf-size-report.awk" \
|
||||||
-v mcu="${MCU}" \
|
-v mcu="${MCU}" \
|
||||||
-v elf="${escelf}" \
|
-v elf="${escelf}" \
|
||||||
-v skip_data=${skip_data} \
|
-v skip_data=${skip_data} \
|
||||||
@@ -170,6 +178,6 @@ for elf in "$@"; do
|
|||||||
done
|
done
|
||||||
# -- if more than one elf file was given, also run a comparison report
|
# -- if more than one elf file was given, also run a comparison report
|
||||||
if (( file_cnt > 1 && compare )) ; then
|
if (( file_cnt > 1 && compare )) ; then
|
||||||
echo "$all_output" | "${base_dir}/elf-size-compare.awk"
|
echo "$all_output" | ${AWKCMD} "${base_dir}/elf-size-compare.awk"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user