#!/bin/bash case "$1" in 'eh_elf') TARGET='eh_elf' LIBUNWIND='eh_elf' branch='eh_elf' ;; 'vanilla') TARGET='vanilla' LIBUNWIND='vanilla' branch='vanilla_timer' ;; 'vanilla-nocache') TARGET='vanilla-nocache' LIBUNWIND='vanilla' branch='vanilla_timer_nocache' ;; *) >&2 echo "Usage: $0 [ eh_elf | vanilla | vanilla-nocache ]" exit 1 esac original_branch=$(git rev-parse --abbrev-ref HEAD) if ! git checkout "$branch" ; then >&2 echo "Failed to checkout $branch - maybe your git isn't clean?" exit 2 fi LIBUNWIND_PREFIX="$HOME/local/libunwind-$LIBUNWIND-dbg" LIBUNWIND_LIB="$LIBUNWIND_PREFIX/lib" PREFIX="$HOME/local/perf-$TARGET" export CPATH=$LIBUNWIND_PREFIX/include export LD_LIBRARY_PATH=$LIBUNWIND_LIB export EXTRA_CFLAGS=-L$LIBUNWIND_LIB make -j mkdir -p $PREFIX/bin cp "perf" "$PREFIX/bin/" git checkout "$original_branch"