fish-shell/muparser/bk-deps
Kurtis Rader d247c121a2 Check-in MuParser source
First step in fixing issue #3157 is to check-in the source code and hook
it into our build system.

The inclusion of the MuParser source adds the MIT License to those that
apply to fish. Update our documentation to reflect that fact.

The MuParser documentation is at
http://beltoforion.de/article.php?a=muparser.  The source was downloaded
from https://github.com/beltoforion/muparser/releases. It is also hosted
on Github, https://github.com/beltoforion/muparser/. I did not download
it from Github because that source contained just a couple of cleanup
changes which don't affect its behavior.
2017-08-23 14:43:45 -07:00

123 lines
3.1 KiB
Bash
Executable File

#!/bin/sh
# This script is part of Bakefile (http://www.bakefile.org) autoconf
# script. It is used to track C/C++ files dependencies in portable way.
#
# Permission is given to use this file in any way.
DEPSMODE=gcc
DEPSFLAG="-no-cpp-precomp -MMD"
DEPSDIRBASE=.deps
if test $DEPSMODE = gcc ; then
$* ${DEPSFLAG}
status=$?
# determine location of created files:
while test $# -gt 0; do
case "$1" in
-o )
shift
objfile=$1
;;
-* )
;;
* )
srcfile=$1
;;
esac
shift
done
objfilebase=`basename $objfile`
builddir=`dirname $objfile`
depfile=`basename $srcfile | sed -e 's/\..*$/.d/g'`
depobjname=`echo $depfile |sed -e 's/\.d/.o/g'`
depsdir=$builddir/$DEPSDIRBASE
mkdir -p $depsdir
# if the compiler failed, we're done:
if test ${status} != 0 ; then
rm -f $depfile
exit ${status}
fi
# move created file to the location we want it in:
if test -f $depfile ; then
sed -e "s,$depobjname:,$objfile:,g" $depfile >${depsdir}/${objfilebase}.d
rm -f $depfile
else
# "g++ -MMD -o fooobj.o foosrc.cpp" produces fooobj.d
depfile=`echo "$objfile" | sed -e 's/\..*$/.d/g'`
if test ! -f $depfile ; then
# "cxx -MD -o fooobj.o foosrc.cpp" creates fooobj.o.d (Compaq C++)
depfile="$objfile.d"
fi
if test -f $depfile ; then
sed -e "\,^$objfile,!s,$depobjname:,$objfile:,g" $depfile >${depsdir}/${objfilebase}.d
rm -f $depfile
fi
fi
exit 0
elif test $DEPSMODE = mwcc ; then
$* || exit $?
# Run mwcc again with -MM and redirect into the dep file we want
# NOTE: We can't use shift here because we need $* to be valid
prevarg=
for arg in $* ; do
if test "$prevarg" = "-o"; then
objfile=$arg
else
case "$arg" in
-* )
;;
* )
srcfile=$arg
;;
esac
fi
prevarg="$arg"
done
objfilebase=`basename $objfile`
builddir=`dirname $objfile`
depsdir=$builddir/$DEPSDIRBASE
mkdir -p $depsdir
$* $DEPSFLAG >${depsdir}/${objfilebase}.d
exit 0
elif test $DEPSMODE = unixcc; then
$* || exit $?
# Run compiler again with deps flag and redirect into the dep file.
# It doesn't work if the '-o FILE' option is used, but without it the
# dependency file will contain the wrong name for the object. So it is
# removed from the command line, and the dep file is fixed with sed.
cmd=""
while test $# -gt 0; do
case "$1" in
-o )
shift
objfile=$1
;;
* )
eval arg$#=\$1
cmd="$cmd \$arg$#"
;;
esac
shift
done
objfilebase=`basename $objfile`
builddir=`dirname $objfile`
depsdir=$builddir/$DEPSDIRBASE
mkdir -p $depsdir
eval "$cmd $DEPSFLAG" | sed "s|.*:|$objfile:|" >${depsdir}/${objfilebase}.d
exit 0
else
$*
exit $?
fi