Skip to content

Instantly share code, notes, and snippets.

@kjdev
Created May 22, 2013 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjdev/5631566 to your computer and use it in GitHub Desktop.
Save kjdev/5631566 to your computer and use it in GitHub Desktop.
#!/bin/bash
files=(libtool ltmain.sh)
srcdir=`pwd`
IFS=$'\n'
for file in ${files[@]}
do
if [ ! -f ${srcdir}/${file} ]; then
continue
fi
num=
lines=($(grep -n -A 1 '[ \t]*\*.$objext)' ${srcdir}/${file}))
for line in ${lines[@]}
do
check_num=`echo -n ${line} | cut -d ':' -f 1`
check_process=`echo -n ${line} | cut -d '-' -f 2 | sed 's/[ \t]//g'`
num_empty=`echo -n ${check_num} | sed 's/[0-9]//g'`
if [ ! "x" = "x${check_num}" -a "x" = "x${num_empty}" ]; then
num=${check_num}
else
process=${check_process}
fi
if [ ! "x${num}" = "x" -a "${process}" = ";;" ]; then
sed -i -e "${num}s/\*\.\$objext/\*\.\$objext | \*\.gcno/" ${srcdir}/${file}
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment