1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-22 09:38:56 +08:00
hl2sdk/devtools/gendbg.sh
Nicholas Hastings 3957adff10 Sync with upstream (Issue #30).
Recompiled tier1 and mathlib  for all platforms will come in next commit.
2016-11-30 10:01:15 -05:00

45 lines
747 B
Bash
Executable File

#!/bin/bash
OBJCOPY=$STEAM_RUNTIME_PATH/bin/objcopy
function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]"
echo ""
}
if [ $# == 0 ]; then
usage
exit 2
fi
if [ $(basename $1) == $1 ]; then
INFILEDIR=$PWD
else
INFILEDIR=$(cd ${1%/*} && echo $PWD)
fi
INFILE=$(basename $1)
OUTFILEDIR=$INFILEDIR
OUTFILE=$INFILE.dbg
while getopts "o:" opt; do
case $opt in
o)
OUTFILEDIR=$(cd ${OPTARG%/*} && echo $PWD)
OUTFILE=$(basename $OPTARG)
;;
esac
done
if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then
INFILE=${INFILEDIR}/${INFILE}
OUTFILE=${OUTFILEDIR}/${OUTFILE}
fi
pushd "$INFILEDIR"
$OBJCOPY "$INFILE" "$OUTFILE"
$OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE"
popd