1 |
#!/bin/bash |
2 |
# |
3 |
# Ed Hill |
4 |
# |
5 |
# This is a replacement for "./makebrowseablecodepages.sh" |
6 |
# |
7 |
# $Header: /u/gcmpack/mitgcm.org/devel/buildweb/code-browser/MakeBrowseableMITGCM/build_browseable_code,v 1.1 2003/08/07 18:27:51 edhill Exp $ |
8 |
|
9 |
SOURCEDIR=../../../../../MITgcm |
10 |
SUBDIRS="./eesupp ./lsopt ./model ./optim ./pkg ./verification" |
11 |
SDIRLINK=work |
12 |
CDIR=`pwd` |
13 |
|
14 |
echo |
15 |
echo "Creating soft-link to the source tree" |
16 |
if [ -L $SDIRLINK ]; then |
17 |
echo "Using source tree at the existing link: " $SDIRLINK |
18 |
else |
19 |
if [ -d $SOURCEDIR ]; then |
20 |
echo "Using source tree at: " $SOURCEDIR |
21 |
ln -s $SOURCEDIR $SDIRLINK |
22 |
else |
23 |
echo "ERROR: can't find source tree" |
24 |
exit 1 |
25 |
fi |
26 |
fi |
27 |
|
28 |
echo |
29 |
echo "Building the code parser" |
30 |
make -C ../F90Mapper |
31 |
|
32 |
echo |
33 |
echo "Building the definition parser" |
34 |
make -C ../DefinitionParser |
35 |
|
36 |
echo |
37 |
echo "Finding all source (\"*.[F,h]\") files " |
38 |
cp callTree.F callTree.header $SDIRLINK |
39 |
cd $SDIRLINK |
40 |
SRCFILES="./callTree.F" |
41 |
for dir in $SUBDIRS |
42 |
do |
43 |
echo " searching in "$dir |
44 |
add="`/usr/bin/find "$dir" -name '*.[F,h]'`" |
45 |
SRCFILES=$SRCFILES" "$add |
46 |
done |
47 |
|
48 |
echo |
49 |
echo "Running the definition parser" |
50 |
cat $SRCFILES | ${CDIR}/../DefinitionParser/a.out > thedefs |
51 |
RETVAL=$? |
52 |
if [ $RETVAL != 0 ]; then |
53 |
echo "ERROR: DefinitionParser failed" |
54 |
exit 1 |
55 |
fi |
56 |
|
57 |
echo |
58 |
echo "Running the code parser" |
59 |
${CDIR}/../F90Mapper/f90mapper -d thedefs $SRCFILES > mapper.log |
60 |
RETVAL=$? |
61 |
if [ $RETVAL != 0 ]; then |
62 |
echo "ERROR: F90Mapper failed -- please see "$SDIRLINK"/mapper.log" |
63 |
exit 1 |
64 |
fi |
65 |
|
66 |
echo |
67 |
echo "Generating hyperlinked call tree" |
68 |
grep 'New variable' mapper.log | awk '{print $3, $6}' > varkey |
69 |
awk -f ${CDIR}/parseCallTree.awk callTree.F > callTree.html |
70 |
|
71 |
echo |
72 |
echo "Making buildweb sub-directory entries for skeletons/code_reference/" |
73 |
rm -rf buildweb |
74 |
tmp="buildweb/skeleton/code_reference" |
75 |
mkdir -p $tmp |
76 |
cp code_reference-rtparm_exp.htm $tmp"/parameters.html" |
77 |
cp code_reference-sf_exp.htm $tmp"/sourcefiles.html" |
78 |
cp code_reference-subfunc_exp.htm $tmp"/subroutine.html" |
79 |
cp code_reference-vi_exp.htm $tmp"/variabledictionary.html" |
80 |
cp callTree.html $tmp |
81 |
|
82 |
echo |
83 |
echo "Making buildweb sub-directory entries for vdb/" |
84 |
mv vdb buildweb/vdb |
85 |
|
86 |
echo |
87 |
echo "Making buildweb sub-directory entries for vdb/byname" |
88 |
( cd buildweb/vdb ; ${CDIR}/create_name_links ) |
89 |
|
90 |
echo |
91 |
echo "Creating the tarball" |
92 |
( cd buildweb ; rm vdb/tmp[1,2]; tar -czf ../web.tar.gz . &> /dev/null ) |