Brian Silverman | 95de062 | 2015-03-08 22:04:06 -0400 | [diff] [blame] | 1 | #!/bin/dash |
2 | |||||
3 | set -e | ||||
4 | |||||
5 | OBJCOPY=$1 | ||||
6 | shift | ||||
7 | |||||
8 | # The arguments after any -o flags. | ||||
9 | OUTPUT=`echo "$@" | awk \ | ||||
10 | 'BEGIN { RS=" " }; output { print ; output = 0 }; /-o/ { output = 1 }'` | ||||
11 | DEBUG_DIR=$(dirname $(dirname ${OUTPUT}))/unstripped_files | ||||
12 | mkdir -p ${DEBUG_DIR} | ||||
13 | DEBUG_FILE=${DEBUG_DIR}/$(basename ${OUTPUT}).full | ||||
14 | |||||
15 | "$@" | ||||
16 | |||||
17 | cp ${OUTPUT} ${DEBUG_FILE} | ||||
18 | ${OBJCOPY} --strip-debug --add-gnu-debuglink=${DEBUG_FILE} ${OUTPUT} |