Commit 2cc5b0facf (git-gui: extract script to generate "tclIndex",
2025-03-11) converted commands in a Makefile rule to a shell script.
In this process, the Makefile variable $@ had to be replaced by the
file name that it represents, 'lib/tclIndex'. However, the occurrence
in `rm -f $@` was missed. In a shell script, $@ expands to all
command line arguments, which happen to be the source files lib/*.tcl
in this case. Needless to say that we do not want to remove source
files during a build. Replace $@ by the intended 'lib/tclIndex'.
Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
33 lines
618 B
Bash
Executable File
33 lines
618 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if test "$#" -lt 3
|
|
then
|
|
echo >&2 "usage: $0 <BUILD_DIR> <BUILD_OPTIONS> <LIBFILE> [<LIBFILE>...]"
|
|
exit 1
|
|
fi
|
|
|
|
BUILD_DIR="$1"
|
|
BUILD_OPTIONS="$2"
|
|
shift 2
|
|
LIBFILES="$(echo "$@" | sort | sed 's|lib/||g')"
|
|
|
|
. "$BUILD_OPTIONS"
|
|
|
|
cd "$BUILD_DIR"
|
|
|
|
if {
|
|
echo "source lib/class.tcl;"
|
|
echo "auto_mkindex lib $LIBFILES"
|
|
} | "$TCL_PATH"
|
|
then
|
|
: ok
|
|
else
|
|
echo >&2 " * $TCL_PATH failed; using unoptimized loading"
|
|
rm -f lib/tclIndex
|
|
echo '# Autogenerated by git-gui Makefile' >lib/tclIndex
|
|
echo >>lib/tclIndex
|
|
echo "class.tcl" >>lib/tclIndex
|
|
printf "%s\n" $LIBFILES >>lib/tclIndex
|
|
echo >>lib/tclIndex
|
|
fi
|