summaryrefslogtreecommitdiff
path: root/db/dist/s_include
blob: fee6e50330f2d2204c56c176934ab0042c3758b1 (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
#!/bin/sh -
#	$Id: s_include,v 1.7 2000/07/13 18:38:46 bostic Exp $
#
# Build the automatically generated function prototype files.

msgc="/* DO NOT EDIT: automatically built by dist/s_include. */"
cxx_if="#if defined(__cplusplus)"
cxx_head="extern \"C\" {"
cxx_foot="}"
cxx_endif="#endif"

tmp=/tmp/__db_inc.$$
trap 'rm -f $tmp ; exit 0' 0 1 2 3 13 15

for i in db btree clib common env hash \
    lock log mp mutex os qam rpc_client rpc_server tcl txn xa; do
	f=../include/${i}_ext.h
	(echo "$msgc" &&
	    echo "#ifndef	_${i}_ext_h_" &&
	    echo "#define	_${i}_ext_h_" &&
	    echo "$cxx_if" &&
	    echo "$cxx_head" &&
	    echo "$cxx_endif" &&
	    sed -n "s/^ \* PUBLIC:[	 ]\(.*\)/\1/p" ../$i/*.c;
	    [ $i = os ] &&
		sed -n "s/^ \* PUBLIC:[	 ]\(.*\)/\1/p" ../os_win32/*.c;
	    echo "$cxx_if" &&
	    echo "$cxx_foot" &&
	    echo "$cxx_endif" &&
	    echo "#endif /* _${i}_ext_h_ */") > $tmp
	cmp $tmp $f > /dev/null 2>&1 ||
	    (echo "Building $f" && rm -f $f && cp $tmp $f && chmod 444 $f)
done