| #!/bin/sh |
| |
| # |
| # Copyright 2014-2016 Nest Labs Inc. All Rights Reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| # |
| # Description: |
| # This file is a convenience script for cleaning up, for the |
| # current build host system, the intermediate build results for |
| # the minimal, core set of GNU autotools on which other projects' |
| # build systems depend. |
| # |
| |
| # |
| # usage |
| # |
| # Display program usage. |
| # |
| usage() { |
| name=`basename ${0}` |
| |
| echo "Usage: ${name} [ options ] [ -- <package> ... ]" |
| |
| if [ $1 -ne 0 ]; then |
| echo "Try '${name} -h' for more information." |
| fi |
| |
| if [ $1 -ne 1 ]; then |
| echo "" |
| echo " -h, --help Print this help, then exit." |
| echo "" |
| fi |
| |
| exit $1 |
| } |
| |
| # Parse out any command line options |
| |
| while [ ${#} -gt 0 ]; do |
| if [ ${1} == "-h" ] || [ ${1} == "--help" ]; then |
| usage 0 |
| |
| elif [ ${1} == "--" ]; then |
| shift 1 |
| break |
| |
| else |
| usage 1 |
| |
| fi |
| done |
| |
| # Determine what packages to clean |
| |
| if [ ${#} -gt 0 ]; then |
| SUBDIRS="${*}" |
| |
| else |
| SUBDIRS="`cat packages`" |
| |
| fi |
| |
| stem=tools/packages |
| abs_srcdir=`pwd` |
| abs_top_srcdir=`echo ${abs_srcdir} | sed -e s,/${stem},,g` |
| |
| abs_top_hostdir="${abs_top_srcdir}/tools/host" |
| |
| # Figure out what sort of build host we are running on, stripping off |
| # any trailing version number information typically included on Darwin |
| # / Mac OS X. |
| |
| host=`../../autoconf/config.guess | sed -e 's,[[:digit:].]*$,,g'` |
| |
| echo "================================================================================" |
| echo "Cleaning GNU autotools for ${host}..." |
| |
| for subdir in ${SUBDIRS}; do |
| echo "--------------------------------------------------------------------------------" |
| version=`cat ${subdir}/${subdir}.version` |
| package="${subdir}-${version}" |
| |
| echo "Cleaning ${subdir}..." |
| rm -r -f ${subdir}/build/${host} |
| rm -r -f ${subdir}/${package} |
| |
| echo "Done." |
| cd ${abs_srcdir} || exit ${?} |
| done |
| |
| echo "================================================================================" |