Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / tools / build_codebase
blob4dd16170afcc32ad61d03a9776676fa0c8d0bffc
1 #!/bin/csh
4 set db=tools/code_dbase
6 #goto skippy
7 #goto sk1
8 # set this to a value to speed up the subinfo calls; set with no value for normal
9 set gofast # default is not fast (no value given, but set)
11 if ( $#argv == 1 ) then
12 if ( $argv[1] == "fast" ) then
13 set gofast=yes
14 endif
15 endif
17 if ( ! -d tools ) then
18 echo run $0 in top level WRF directory
19 endif
20 if ( ! -x tools/deftab || ! -x tools/nocontf90 || ! -x tools/subinfo_calls || ! -x tools/callgraph ) then
21 ( cd tools/CodeBase ; make )
22 if ( ! -x tools/deftab || ! -x tools/nocontf90 || ! -x tools/subinfo_calls || ! -x tools/callgraph ) then
23 echo some error building the tools in tools/CodeBase. Cannot continue.
24 exit(2)
25 endif
26 endif
28 /bin/rm -fr $db
29 mkdir $db
31 if ( ! -f frame/module_state_description.f ) then
32 echo
33 echo '*** ' code must be compiled first before code database can be built
34 echo '*** ' because it is based on the .f files
35 echo
36 exit(99)
37 endif
38 set dirs=( dyn_em frame main phys share )
39 #set dirs=( dyn_nmm frame main phys share )
40 #set dirs=( phys )
41 #set dirs=( main )
42 foreach d ( $dirs )
43 foreach f ( $d/*.f )
44 set ff=$f:t
45 echo $f
46 tools/nocontf90 < $f | expand | \
47 sed \
48 -e 's/ */ /g' \
49 -e 's/^ //' \
50 -e '/^$/d' \
51 -e 's/^real,/real ,/' \
52 -e 's/^integer,/integer ,/' \
53 -e 's/^type(/type (/' \
54 -e 's/^logical,/logical ,/' \
55 > $db/lm_${f:t}_1
56 tools/deftab $f < $db/lm_${f:t}_1
57 /bin/rm -f $db/lm_${f:t}_1
58 end
59 end
61 cat -n $db/calls | sort -u +1 > xxx
62 sort -n +0 -1 xxx | awk '{print $2 " " $3 " " $4}' > $db/calls
64 ############ pre-compute the subinfo html entries ##########
66 skippy:
68 foreach f ( `/bin/ls -1 $db | grep -v '\.html' | grep -v calls | grep -v '^lm_' | grep -v '^vv_' | grep -v '_descrip$'` )
69 echo creating html file for $f
70 tools/subinfo $f $gofast > $db/$f.html
71 end
73 #foreach f ( `/bin/ls -1 $db/[a-f]* | grep -v '\.html' | grep -v calls | grep -v '^lm_'` )
74 # echo creating html file for $f
75 # tools/subinfo $f:t > $f.html
76 #end
77 #foreach f ( `/bin/ls -1 $db/[g-m]* | grep -v '\.html' | grep -v calls | grep -v '^lm_'` )
78 # echo creating html file for $f
79 # tools/subinfo $f:t > $f.html
80 #end
81 #foreach f ( `/bin/ls -1 $db/[n-t]* | grep -v '\.html' | grep -v calls | grep -v '^lm_'` )
82 # echo creating html file for $f
83 # tools/subinfo $f:t > $f.html
84 #end
85 #foreach f ( `/bin/ls -1 $db/[u-z]* | grep -v '\.html' | grep -v calls | grep -v '^lm_'` )
86 # echo creating html file for $f
87 # tools/subinfo $f:t > $f.html
88 #end
90 echo "Creating $db/index.html"
92 /bin/cp tools/callgraph.page1 $db/callgraph.html
93 tools/callgraph wrf 7 >> $db/callgraph.html
94 cat tools/callgraph.page2 >> $db/callgraph.html
95 /bin/cp tools/index.page $db/index.html
96 /bin/cp tools/collapsd.gif tools/daughter.gif tools/exploded.gif $db
98 sk1:
99 #tools/callgraph wrf 0 > $db/index.html
100 #echo ct2.html
101 #tools/callgraph wrf 1 > $db/ct2.html
102 #echo ct3.html
103 #tools/callgraph wrf 2 > $db/ct3.html
104 #echo ct4.html
105 #tools/callgraph wrf 3 > $db/ct4.html
106 #echo ct5.html
107 #tools/callgraph wrf 4 > $db/ct5.html
108 #echo ctall.html
109 #tools/callgraph wrf > $db/ctall.html
111 echo "Done"