#!/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: [VARIANT=] [SENSORBOARD=] tos-maketags # # One of VARIANT or SENSORBOARD might be used by a TinyOS application for code # selection during conditional compile. # # R. Steve McKown cleanup() { rm -f ctags.tmpm ctags.tmp[12] ctags.files } trap cleanup EXIT if [ -z "$1" ]; then echo "usage: $0 " >&2 exit 1 fi appc=build/$1/app.c CFLAGS=-v VARIANT=$VARIANT SENSORBOARD=$SENSORBOARD 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