summaryrefslogtreecommitdiff
path: root/db-4.8.30/test/scr012/chk.vx_code
blob: 041124fb9f0f3702bde3f63c08f00c46ec71af1c (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh -
#
# $Id$
#
# Check to make sure the auto-generated utility code in the VxWorks build
# directory compiles.

d=../..

[ -f $d/LICENSE ] || {
	echo 'FAIL: cannot find source distribution directory.'
	exit 1
}
[ -f ../libdb.a ] || (cd .. && make libdb.a) || {
	echo 'FAIL: unable to find or build libdb.a'
	exit 1
}

F="$d/clib/getopt.c $d/common/util_arg.c $d/common/util_cache.c
	$d/common/util_log.c $d/common/util_sig.c $d/*/*_autop.c"

header()
{
	echo "int $1(int, char *[]);"
	echo "int"
	echo "main(int argc, char *argv[])"
	echo "{return ($1(argc, argv));}"
}

LIST="\
    db_archive \
    db_checkpoint \
    db_deadlock \
    db_dump \
    db_hotbackup \
    db_load \
    db_printlog \
    db_recover \
    db_stat \
    db_upgrade \
    db_verify \
    dbdemo \
    test_micro"

# Build each program individually.
for i in $LIST; do
	echo "	compiling Vxworks version of $i"
	header $i > MAIN.c
	if cc -Wall -I.. -I$d -I$d/build_vxworks/$i \
	    $d/build_vxworks/$i/*.c MAIN.c $F ../libdb.a -o t; then
		:
	else
		echo "FAIL: unable to compile VxWorks version of $i"
		exit 1
	fi
done

# Build all of the programs as one big binary.
inc=`echo $LIST | sed 's/[^ ][^ ]*/-I$d\/build_vxworks\/&/g'`
src=`echo $LIST | sed 's/[^ ][^ ]*/$d\/build_vxworks\/&\/*.c/g'`

(
for i in $LIST; do
	echo "int ${i}_main(int, char *[]);"
done
echo "int"
echo "main(int argc, char *argv[])"
echo "{"
echo "int r;"
for i in $LIST; do
	echo "r += ${i}_main(argc, argv);"
done
echo "return (r);"
echo "}"
) > MAIN.c

echo "	compiling VxWorks utility composite"
if cc -Wall -I.. -I$d $inc `eval ls $src` MAIN.c $F ../libdb.a -o t; then
	:
else
	echo 'FAIL: unable to compile VxWorks utility composite'
	exit 1
fi

exit 0