]> oss.titaniummirror.com Git - tinyos-utils.git/commitdiff
Add maketags utility
authorR. Steve McKown <rsmckown@gmail.com>
Tue, 11 Dec 2012 16:07:49 +0000 (09:07 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 11 Dec 2012 16:09:09 +0000 (09:09 -0700)
maketags builds a tags file for a compilable TinyOS application

tos-maketags [new file with mode: 0755]

diff --git a/tos-maketags b/tos-maketags
new file mode 100755 (executable)
index 0000000..1ee9653
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Build ctags for a TinyOS application.  The application must compile cleanly,
+# as output from the build is used to determine what source files to process.
+#
+# usage: maketags <platform>
+#
+# R. Steve McKown <rsmckown@gmail.com>
+
+cleanup()
+{
+  rm -f ctags.tmpm ctags.tmp[12] ctags.files
+}
+
+trap cleanup EXIT
+
+if [ -z "$1" ]; then
+  echo "usage: $0 <platform>" >&2
+  exit 1
+fi
+
+appc=build/$1/app.c
+CFLAGS=-v make "$1" >ctags.tmpm 2>&1
+[ $? -ne 0 -o ! -f $appc ] && echo "$0: can't compile $1" >&2 && exit 1
+grep "preprocessing" < ctags.tmpm | sed -e 's|^preprocessing ||' > ctags.tmp1
+grep "^# [0-9]* " $appc | awk -F\" '{ print $2 }' | sort -u > ctags.tmp2
+cat ctags.tmp[12] | sort -u > ctags.files
+ctags -I nx_struct=struct -L ctags.files