/[MITgcm]/MITgcm/doc/api_reference/configure
ViewVC logotype

Contents of /MITgcm/doc/api_reference/configure

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Mar 26 19:41:44 2004 UTC (19 years, 11 months ago) by edhill
Branch: MAIN
 o initial check-in

1 #! /usr/bin/env sh
2 #
3 # $Header: $
4 #
5 # A script to generate the Makefile for the API Reference
6
7 if ! test -r ./dir_list ; then
8 cat <<EOF
9 ERROR: cannot read the directory list -- please verify that this
10 script is run in MITGCM_ROOT/doc/api_reference and that the
11 "dir_list" file is readable.
12 EOF
13 exit 1
14 fi
15
16 cat ./dir_list | grep -v '^[ ]*#' | grep -v '^[ ]*$' > ./.dir_list_nocomments
17
18 name=$0
19 cat <<EOF > Makefile
20 #
21 # CREATED BY $name -- DO NOT EDIT !!!
22 #
23
24 all: all_protex
25
26 clean:
27 -rm -f *.tex
28
29 EOF
30
31 rm -rf ./.targets
32 cat ./.dir_list_nocomments | while read line ; do
33
34 echo >> Makefile
35 base_target=`echo $line | awk '{print $1}' | sed -e 's|/|__|g'`
36 target=$base_target".tex"
37 echo "Finding files for \"$target\" in: $line"
38 F_files=""
39 h_files=""
40 c_files=""
41 for i in $line ; do
42 F_files="$F_files"`ls -1 ../../$i/*.F 2>/dev/null`
43 h_files="$h_files"`ls -1 ../../$i/*.h 2>/dev/null`
44 c_files="$c_files"`ls -1 ../../$i/*.c 2>/dev/null`
45 done
46
47 # *.F
48 printf '%s' $base_target"_F = " >> Makefile
49 for i in $F_files ; do
50 printf '\\\n%s' " $i " >> Makefile
51 done
52 printf '\n' >> Makefile
53
54 # *.h
55 printf '%s' $base_target"_h = " >> Makefile
56 for i in $h_files ; do
57 printf '\\\n%s' " $i " >> Makefile
58 done
59 printf '\n' >> Makefile
60
61 # *.c
62 printf '%s' $base_target"_c = " >> Makefile
63 for i in $c_files ; do
64 printf '\\\n%s' " $i " >> Makefile
65 done
66 printf '\n' >> Makefile
67 d_F="\$("$base_target"_F)"
68 d_h="\$("$base_target"_h)"
69 d_c="\$("$base_target"_c)"
70 cat <<EOF >> Makefile
71 $target: $d_F $d_h $d_c
72 -rm -f $target
73 EOF
74 if test ! "x$F_files" = x ; then
75 printf '\t%s\n' "-./protex -7 $d_F >> $target" >> Makefile
76 fi
77 if test ! "x$h_files" = x ; then
78 printf '\t%s\n' "-./protex -7 $d_h >> $target" >> Makefile
79 fi
80 if test ! "x$c_files" = x ; then
81 printf '\t%s\n' "-./protex -C $d_c >> $target" >> Makefile
82 fi
83
84 if test ! "x$target" = x ; then
85 printf '%s' " $target" >> ./.targets
86 fi
87 done
88
89 alltex=`cat ./.targets`
90 printf '\n%s' "ALLTEX = " >> Makefile
91 for i in $alltex ; do
92 printf '\\\n%s' " $i " >> Makefile
93 done
94 printf '\n\n' >> Makefile
95
96 cat <<EOF >> Makefile
97
98 makefile:
99 $0
100
101
102 all_protex: \$(ALLTEX)
103 -echo "hi"
104
105
106 EOF
107
108 rm -f ./.dir_list_nocomments

  ViewVC Help
Powered by ViewVC 1.1.22