summaryrefslogtreecommitdiffstats
path: root/dtrace
blob: b8a1237ebff8dc2820405dc51bc5238c21f30e55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# This is a stub to handle a Makefile which does:
# $(DTRACE) $(DTRACEFLAGS) -G -s $^ -o $@
# which is a step that builds DTrace provider and probe definitions

usage() {
echo "Usage $0 -s file.d {-o file} file1.o file2.o ..."
}

if [ -z "$1" ] ; then
   usage
   exit
fi
while test ! -z "$1" ; do
   if [ $(expr "$1" : "-o") -gt 0 ] ; then 
      shift
      filename=$1
   elif [ $(expr "$1" : "-s") -gt 0 ] ; then
      shift
      s_filename=$1      
   fi
   shift
done

if [ -z "$filename" ] ; then
   if [ ! -z "$s_filename" ] ; then
      filename=$(basename $s_filename .d).o
   else
      usage
      exit
   fi
fi

echo "_dtrace_ () {}" >| /tmp/$$.c 
gcc -c /tmp/$$.c -o $filename
rm /tmp/$$.c