Files
mongo/dist/s_prototypes
Keith Bostic d3a8060e5b WT-2658 Only include PPC-specific files in PPC builds (#2758)
* WT-2658 Only include PPC-specific files in PPC builds

* Add support for conditional file inclusion by adding a second argument on lines in dist/filelist.  Add a new automake conditional, POWERPC_HOST, set for the various PPC host CPUs.  Change dist/filelist to only compile the checksum/power8 files if POWERPC_HOST is set.

* Merge the Windows and POSIX file lists, use POSIX_HOST and WINDOWS_HOST to mark source files needed for builds on those systems.
2016-06-03 12:54:40 +10:00

64 lines
1.6 KiB
Bash
Executable File

#! /bin/sh
# Build a list of internal function and variable prototypes.
t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15
# proto --
# extract public functions.
proto()
{
sed -n \
-e '/^__wt_[a-z]/!{' \
-e h \
-e d \
-e '}' \
-e x \
-e '/^static/d' \
-e x \
-e ': loop' \
-e H \
-e n \
-e '/;/b end' \
-e '/^{/!b loop' \
-e ': end' \
-e x \
-e 's/ =.*$//' \
-e '/#/!s/\n/ /g' \
-e 's/\* /\*/g' \
-e 's/ */ /g' \
-e 's/^/extern /' \
-e 's/WT_GCC_FUNC_/WT_GCC_FUNC_DECL_/' \
-e 's/$/;/p' < $1
}
(
cat <<EOF
/* DO NOT EDIT: automatically built by dist/s_prototypes. */
EOF
# First, get prototypes for everything but the OS directories.
# Second, get prototypes for the OS directories.
# The reason for this is because the OS directories repeat names (that is, there
# are common names in both os_posix and os_win), and so we sort the prototypes
# to avoid repeating them in the output (which some compilers won't tolerate).
# We'd sort everything and discard duplicates, but we can't sort when function
# signatures are on multiple lines, that is, #ifdef'd function signatures. Since
# the OS directories are the only places with repeated names, and they have no
# #ifdef'd signatures, we do it this way.
l=`sed -e '/^[a-z]/!d' -e '/src\/os/d' -e 's/[ ].*$//' filelist`
for i in $l; do
proto ../$i
done
l=`echo ../src\/os*/*.c`
for i in $l; do
proto $i
done | env LC_ALL=C sort -u
) > $t
f=../src/include/extern.h
cmp $t $f > /dev/null 2>&1 ||
(echo "Building $f" && rm -f $f && cp $t $f)