blob: 8280e3d76ae1a10ec4deb43160aaeb04a694f64c [file] [log] [blame]
mostang.com!davidmc2e6b4c2003-03-28 07:43:22 +00001#!/bin/sh
mostang.com!davidmdfdbabd2004-05-04 22:19:18 +00002cwd=`pwd`
3dir=`basename ${cwd}`
4#
5# When compiling a file that goes into libunwind, we only
6# need to compile it when we really do support UNW_LOCAL_ONLY.
7# In contrast, libunwind-tests should always get compiled.
8#
9if test $dir = "tests"; then
10 local_only_test=""
11else
12 local_only_test="defined(UNW_LOCAL_ONLY) && "
13fi
mostang.com!davidme455a922003-04-23 19:22:42 +000014for gname in `ls G*.c G*.cxx G*.S 2>/dev/null`; do
mostang.com!davidmc2e6b4c2003-03-28 07:43:22 +000015 lname="L$(expr $gname : '.\(.*\)')"
16 bk edit $lname >/dev/null 2>&1
mostang.com!davidme455a922003-04-23 19:22:42 +000017 ext=$(expr $gname : '[^.]*[.]\(.*\)')
18 if [ "$ext" = "S" ]; then
19 include=""
20 else
21 include="#include <libunwind.h>"
22 fi
mostang.com!davidm50e11fa2003-04-03 07:59:15 +000023 echo -e "\
24#define UNW_LOCAL_ONLY\n\
mostang.com!davidme455a922003-04-23 19:22:42 +000025$include\n\
mostang.com!davidmdfdbabd2004-05-04 22:19:18 +000026#if ${local_only_test}!defined(UNW_REMOTE_ONLY)\n\
mostang.com!davidm50e11fa2003-04-03 07:59:15 +000027#include \"$gname\"\n\
28#endif" > $lname
29 echo created $lname
mostang.com!davidmc2e6b4c2003-03-28 07:43:22 +000030done