don't touch Application.mk unless it's changed to avoid recompiling every .c file each time

This commit is contained in:
Eric House 2013-11-09 05:20:21 -08:00
parent 6107400835
commit 57c887b8cd

View file

@ -3,17 +3,29 @@
set -u -e
APPMK=./jni/Application.mk
TMP_MK=/tmp/tmp_$$_Application.mk
XWORDS_DEBUG_ARMONLY=${XWORDS_DEBUG_ARMONLY:-""}
XWORDS_DEBUG_X86ONLY=${XWORDS_DEBUG_X86ONLYx:-""}
echo "# Generated by $0; do not edit!!!" > $APPMK
echo "# Generated by $0; do not edit!!!" > $TMP_MK
if [ "$1" = "release" ]; then
echo "APP_ABI := armeabi x86" >> $APPMK
echo "APP_ABI := armeabi x86" >> $TMP_MK
elif [ -n "$XWORDS_DEBUG_ARMONLY" ]; then
echo "APP_ABI := armeabi" >> $APPMK
echo "APP_ABI := armeabi" >> $TMP_MK
elif [ -n "$XWORDS_DEBUG_X86ONLY" ]; then
echo "APP_ABI := x86" >> $APPMK
echo "APP_ABI := x86" >> $TMP_MK
else
echo "APP_ABI := armeabi x86" >> $APPMK
echo "APP_ABI := armeabi x86" >> $TMP_MK
fi
# Now replace the existing file, but only if it's different. Touching
# it causes the library to be completely rebuilt, so avoid that if
# possible!
if [ ! -f $APPMK ]; then
cp $TMP_MK $APPMK
elif ! diff $APPMK $TMP_MK; then
cp $TMP_MK $APPMK
fi
rm -f $TMP_MK