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

Annotation of /MITgcm/doc/api_reference/configure

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


Revision 1.2 - (hide annotations) (download)
Fri Mar 26 23:46:11 2004 UTC (19 years, 11 months ago) by edhill
Branch: MAIN
Changes since 1.1: +19 -8 lines
 o most of a framework for building the API Reference automatically

1 edhill 1.1 #! /usr/bin/env sh
2     #
3 edhill 1.2 # $Header: /u/gcmpack/MITgcm/doc/api_reference/configure,v 1.1 2004/03/26 19:41:44 edhill Exp $
4 edhill 1.1 #
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 edhill 1.2 # ========================================
22     #
23 edhill 1.1 # CREATED BY $name -- DO NOT EDIT !!!
24     #
25 edhill 1.2 # ========================================
26     #
27    
28     .SUFFIXES:
29 edhill 1.1
30     all: all_protex
31    
32     clean:
33 edhill 1.2 -rm -f *.tex *.aux *.dvi *.log *.toc
34 edhill 1.1
35     EOF
36    
37     rm -rf ./.targets
38     cat ./.dir_list_nocomments | while read line ; do
39    
40     echo >> Makefile
41     base_target=`echo $line | awk '{print $1}' | sed -e 's|/|__|g'`
42     target=$base_target".tex"
43     echo "Finding files for \"$target\" in: $line"
44     F_files=""
45     h_files=""
46     c_files=""
47     for i in $line ; do
48     F_files="$F_files"`ls -1 ../../$i/*.F 2>/dev/null`
49     h_files="$h_files"`ls -1 ../../$i/*.h 2>/dev/null`
50     c_files="$c_files"`ls -1 ../../$i/*.c 2>/dev/null`
51     done
52    
53     # *.F
54     printf '%s' $base_target"_F = " >> Makefile
55     for i in $F_files ; do
56     printf '\\\n%s' " $i " >> Makefile
57     done
58     printf '\n' >> Makefile
59    
60     # *.h
61     printf '%s' $base_target"_h = " >> Makefile
62     for i in $h_files ; do
63     printf '\\\n%s' " $i " >> Makefile
64     done
65     printf '\n' >> Makefile
66    
67     # *.c
68     printf '%s' $base_target"_c = " >> Makefile
69     for i in $c_files ; do
70     printf '\\\n%s' " $i " >> Makefile
71     done
72     printf '\n' >> Makefile
73     d_F="\$("$base_target"_F)"
74     d_h="\$("$base_target"_h)"
75     d_c="\$("$base_target"_c)"
76     cat <<EOF >> Makefile
77     $target: $d_F $d_h $d_c
78     -rm -f $target
79     EOF
80     if test ! "x$F_files" = x ; then
81 edhill 1.2 printf '\t%s\n' "-./protex -b7 $d_F >> $target" >> Makefile
82 edhill 1.1 fi
83     if test ! "x$h_files" = x ; then
84 edhill 1.2 printf '\t%s\n' "-./protex -b7 $d_h >> $target" >> Makefile
85 edhill 1.1 fi
86     if test ! "x$c_files" = x ; then
87 edhill 1.2 printf '\t%s\n' "-./protex -bC $d_c >> $target" >> Makefile
88 edhill 1.1 fi
89    
90     if test ! "x$target" = x ; then
91     printf '%s' " $target" >> ./.targets
92     fi
93     done
94    
95     alltex=`cat ./.targets`
96     printf '\n%s' "ALLTEX = " >> Makefile
97     for i in $alltex ; do
98     printf '\\\n%s' " $i " >> Makefile
99     done
100     printf '\n\n' >> Makefile
101    
102     cat <<EOF >> Makefile
103    
104     makefile:
105     $0
106    
107 edhill 1.2 api_main.tex: \$(ALLTEX)
108     -./build_main \$(ALLTEX)
109 edhill 1.1
110 edhill 1.2 api_main.dvi: api_main.tex
111     latex api_main
112     latex api_main
113     latex api_main
114 edhill 1.1
115 edhill 1.2 all_protex: api_main.dvi
116 edhill 1.1
117     EOF
118    
119     rm -f ./.dir_list_nocomments
120 edhill 1.2 rm -f ./.targets
121 edhill 1.1

  ViewVC Help
Powered by ViewVC 1.1.22