example_remove.sh

View page source

Undo example_install.sh

Syntax

      bin/example_remove.sh

Purpose

This will remove any files that were installed by example_install.sh . This assumes that the values of cmake_install_prefix and build_type have not changed.

Source

#
# cmake_install_prefix
eval $(grep '^cmake_install_prefix *=' bin/run_cmake.sh)
#
# build_type
eval $(grep '^build_type *=' bin/run_cmake.sh)
#
# remove cppad_mixed
pushd build
make uninstall
popd
#
# remove externals
external_list=$(find external/$build_type -regex '.*[a-zA-Z_].git')
for repo in $external_list
do
   pushd $repo/build
   make uninstall
   popd
done
#
# remove links
if [ -L $cmake_install_prefix/eigen/include/Eigen ]
then
   rm $cmake_install_prefix/eigen/include/Eigen
fi
#
# prune cmake_install_prefix
if [ ! -L $cmake_install_prefix ]
then
   echo "Remove empty directories below $cmake_install_prefix"
   find $cmake_install_prefix -type d -empty -delete
   if [ ! -d $cmake_install_prefix ]
   then
      mkdir $cmake_install_prefix
   fi
else
   echo "Remove empty directories below $cmake_install_prefix.$build_type"
   find $cmake_install_prefix.$build_type -type d -empty -delete
   if [ ! -d $cmake_install_prefix.$build_type ]
   then
      mkdir $cmake_install_prefix.$build_type
   fi
fi
#
echo 'example_remove.sh: OK'
exit 0