summaryrefslogtreecommitdiff
path: root/source4/script/mkproto.sh
diff options
context:
space:
mode:
Diffstat (limited to 'source4/script/mkproto.sh')
-rw-r--r--source4/script/mkproto.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/source4/script/mkproto.sh b/source4/script/mkproto.sh
new file mode 100644
index 0000000000..2bf96c9b41
--- /dev/null
+++ b/source4/script/mkproto.sh
@@ -0,0 +1,43 @@
+#! /bin/sh
+
+LANG=C; export LANG
+LC_ALL=C; export LC_ALL
+LC_COLLATE=C; export LC_COLLATE
+
+if [ $# -lt 3 ]
+then
+ echo "Usage: $0 awk [-h headerdefine] outputheader proto_obj"
+ exit 1
+fi
+
+awk="$1"
+shift
+
+if [ x"$1" = x-h ]
+then
+ headeropt="-v headername=$2"
+ shift; shift;
+else
+ headeropt=""
+fi
+
+header="$1"
+shift
+headertmp="$header.$$.tmp~"
+
+proto_src="`echo $@ | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort | uniq | egrep -v 'ubiqx/|wrapped'`"
+
+echo creating $header
+
+mkdir -p `dirname $header`
+
+${awk} $headeropt \
+ -f script/mkproto.awk $proto_src > $headertmp
+
+if cmp -s $header $headertmp 2>/dev/null
+then
+ echo "$header unchanged"
+ rm $headertmp
+else
+ mv $headertmp $header
+fi