This is a simple script that compares the make variables set by two
different configs stubs. The purpose is to highlight differences so
that any unnecessary duplication or divergence can be removed.

For example, on Linux x86:
    $ ./bin/confdiff.sh linux linux-x86

The output isn't very clean, but it should highlight that the only
difference is that the x86 target uses x86 assembler sources.

The script uses bash, mktemp, make, sed and diff. It is probably not
very portable and might only work on GNU make.
---
 Makefile        |    1 +
 bin/confdiff.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100755 bin/confdiff.sh

diff --git a/Makefile b/Makefile
index 2338aa4..1d14b6a 100644
--- a/Makefile
+++ b/Makefile
@@ -175,6 +175,7 @@ MAIN_FILES = \
        $(DIRECTORY)/Makefile*                                          \
        $(DIRECTORY)/descrip.mms                                        \
        $(DIRECTORY)/mms-config.                                        \
+       $(DIRECTORY)/bin/confdiff.sh                                    \
        $(DIRECTORY)/bin/mklib                                          \
        $(DIRECTORY)/bin/minstall                                       \
        $(DIRECTORY)/configs/[a-z]*                                     \
diff --git a/bin/confdiff.sh b/bin/confdiff.sh
new file mode 100755
index 0000000..568fcd6
--- /dev/null
+++ b/bin/confdiff.sh
@@ -0,0 +1,48 @@
+#!/bin/bash -e
+
+usage()
+{
+       echo "Usage: $0 <target1> <target2>"
+       echo "Highlight differences between Mesa configs"
+       echo "Example:"
+       echo "  $0 linux linux-x86"
+}
+
+die()
+{
+       echo "$@" >&2
+       return 1
+}
+
+case "$1" in
+-h|--help) usage; exit 0;;
+esac
+
+[ $# -lt 2 ] && die 2 targets needed. See $0 --help
+target1=$1
+target2=$2
+
+topdir=$(cd "`dirname $0`"/..; pwd)
+cd "$topdir"
+
+[ -f "./configs/$target1" ] || die Missing configs/$target1
+[ -f "./configs/$target2" ] || die Missing configs/$target2
+
+trap 'rm -f "$t1" "$t2"' 0
+
+t1=$(mktemp)
+t2=$(mktemp)
+
+make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t1
+TOP = .
+include \$(TOP)/configs/$target1
+default:
+EOF
+
+make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t2
+TOP = .
+include \$(TOP)/configs/$target2
+default:
+EOF
+
+diff -pu -I'^#' $t1 $t2
-- 
1.5.2.4


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to