summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_tags
blob: 3ffd636f5046cc21d5817b8a549dbee5fd28eca1 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/sh

# Build tags files.
trap 'rm -f tags' 0 1 2 3 13 15

# Skip this when building release packages
test -n "$WT_RELEASE_BUILD" && exit 0

# We have to be in the dist directory to run.
test -f s_tags || {
    echo "s_tags requires dist be the current working directory"
    exit 1
}

# We require ctags which may not be installed.
type ctags > /dev/null 2>&1 || {
    echo "$0 skipped: ctags not found"
    exit 0
}

# Test to see what flags this ctags binary supports.
flags=""
for i in -d -t -w --language-force=C '-I WT_GCC_FUNC_ATTRIBUTE+'; do
    if ctags $i ../src/conn/api_strerror.c 2>/dev/null; then
        flags="$i $flags"
    fi
done

# If it exists, generate a tags file for the build directory. The user can have
# any number of out-of-source build directories. We will just conventionally test
# for a directory named 'build'.
test -d ../build && (cd ../build &&
rm -f tags &&
ctags $flags ../src/include/*.in `find ../src -name '*.[ch]'` 2>/dev/null)

# Generate a tags file for the src/include directory.
(cd ../src/include &&
rm -f tags &&
ctags $flags ../include/*.in `find .. -name '*.[ch]'` 2>/dev/null)

# Link the tags file into place in the standard source directories, if we're
# at the right level.
link_tag()
{
    if test -e ../include/tags; then
        rm -f tags && ln -s ../include/tags .
    fi
}

# Link to the tags file from standard build and source directories.
dirs="`python -c 'import dist; dist.print_source_dirs()'` ../src/os_win"
for i in $dirs; do
    expr "$i" : ".*/include" > /dev/null && continue

    (cd $i && link_tag)
done

exit 0