Dan Nicholson | d7eb97b | 2007-10-23 18:17:16 -0700 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | usage() |
| 4 | { |
| 5 | echo "Usage: $0 <target1> <target2>" |
| 6 | echo "Highlight differences between Mesa configs" |
| 7 | echo "Example:" |
| 8 | echo " $0 linux linux-x86" |
| 9 | } |
| 10 | |
| 11 | die() |
| 12 | { |
| 13 | echo "$@" >&2 |
| 14 | return 1 |
| 15 | } |
| 16 | |
| 17 | case "$1" in |
| 18 | -h|--help) usage; exit 0;; |
| 19 | esac |
| 20 | |
| 21 | [ $# -lt 2 ] && die 2 targets needed. See $0 --help |
| 22 | target1=$1 |
| 23 | target2=$2 |
| 24 | |
| 25 | topdir=$(cd "`dirname $0`"/..; pwd) |
| 26 | cd "$topdir" |
| 27 | |
| 28 | [ -f "./configs/$target1" ] || die Missing configs/$target1 |
| 29 | [ -f "./configs/$target2" ] || die Missing configs/$target2 |
| 30 | |
| 31 | trap 'rm -f "$t1" "$t2"' 0 |
| 32 | |
| 33 | t1=$(mktemp) |
| 34 | t2=$(mktemp) |
| 35 | |
| 36 | make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t1 |
| 37 | TOP = . |
| 38 | include \$(TOP)/configs/$target1 |
| 39 | default: |
| 40 | EOF |
| 41 | |
| 42 | make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t2 |
| 43 | TOP = . |
| 44 | include \$(TOP)/configs/$target2 |
| 45 | default: |
| 46 | EOF |
| 47 | |
| 48 | diff -pu -I'^#' $t1 $t2 |