/[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.6 - (hide annotations) (download)
Thu Apr 1 05:34:41 2004 UTC (20 years, 2 months ago) by edhill
Branch: MAIN
Changes since 1.5: +18 -7 lines
 o add PS & PDF

1 edhill 1.1 #! /usr/bin/env sh
2     #
3 edhill 1.6 # $Header: /u/gcmpack/MITgcm/doc/api_reference/configure,v 1.5 2004/04/01 05:00:06 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.3 # ================================================
22 edhill 1.2 #
23 edhill 1.3 # CREATED BY "$name" -- DO NOT EDIT !!!
24 edhill 1.1 #
25 edhill 1.3 # ================================================
26 edhill 1.2 #
27    
28     .SUFFIXES:
29 edhill 1.1
30     all: all_protex
31    
32     EOF
33    
34 edhill 1.6 rm -rf ./.targets ./.all_clean
35 edhill 1.1 cat ./.dir_list_nocomments | while read line ; do
36    
37     echo >> Makefile
38     base_target=`echo $line | awk '{print $1}' | sed -e 's|/|__|g'`
39     target=$base_target".tex"
40 edhill 1.6 printf " $target" >> ./.all_clean
41 edhill 1.1 echo "Finding files for \"$target\" in: $line"
42 edhill 1.3 tex_files=""
43     h_files=""
44 edhill 1.1 F_files=""
45     c_files=""
46     for i in $line ; do
47 edhill 1.3 tex_files="$tex_files"`ls -1 ../../$i/*.tex 2>/dev/null`
48     h_files="$h_files"`ls -1 ../../$i/*.h 2>/dev/null`
49 edhill 1.1 F_files="$F_files"`ls -1 ../../$i/*.F 2>/dev/null`
50     c_files="$c_files"`ls -1 ../../$i/*.c 2>/dev/null`
51     done
52    
53 edhill 1.3 # *.tex
54     printf '%s' $base_target"_tex = " >> Makefile
55     for i in $tex_files ; do
56 edhill 1.1 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 edhill 1.3 # *.F
68     printf '%s' $base_target"_F = " >> Makefile
69     for i in $F_files ; do
70     printf '\\\n%s' " $i " >> Makefile
71     done
72     printf '\n' >> Makefile
73    
74 edhill 1.1 # *.c
75     printf '%s' $base_target"_c = " >> Makefile
76     for i in $c_files ; do
77     printf '\\\n%s' " $i " >> Makefile
78     done
79     printf '\n' >> Makefile
80 edhill 1.3 d_tex="\$("$base_target"_tex)"
81     d_h="\$("$base_target"_h)"
82 edhill 1.1 d_F="\$("$base_target"_F)"
83     d_c="\$("$base_target"_c)"
84     cat <<EOF >> Makefile
85 edhill 1.3 $target: $d_tex $d_h $d_F $d_c
86 edhill 1.1 -rm -f $target
87     EOF
88 edhill 1.3 if test ! "x$tex_files" = x ; then
89     printf '\t%s\n' "-cat $d_tex >> $target" >> Makefile
90 edhill 1.1 fi
91     if test ! "x$h_files" = x ; then
92 edhill 1.5 printf '\t%s\n' "-./protex -b7f $d_h >> $target" >> Makefile
93 edhill 1.1 fi
94 edhill 1.3 if test ! "x$F_files" = x ; then
95 edhill 1.5 printf '\t%s\n' "-./protex -b7f $d_F >> $target" >> Makefile
96 edhill 1.3 fi
97 edhill 1.1 if test ! "x$c_files" = x ; then
98 edhill 1.5 printf '\t%s\n' "-./protex -bCf $d_c >> $target" >> Makefile
99 edhill 1.1 fi
100    
101     if test ! "x$target" = x ; then
102     printf '%s' " $target" >> ./.targets
103     fi
104     done
105    
106     alltex=`cat ./.targets`
107     printf '\n%s' "ALLTEX = " >> Makefile
108     for i in $alltex ; do
109     printf '\\\n%s' " $i " >> Makefile
110     done
111     printf '\n\n' >> Makefile
112    
113     cat <<EOF >> Makefile
114    
115     makefile:
116     $0
117    
118 edhill 1.4 api_main.tex: introduction.tex \$(ALLTEX)
119 edhill 1.2 -./build_main \$(ALLTEX)
120 edhill 1.1
121 edhill 1.2 api_main.dvi: api_main.tex
122 edhill 1.3 latex api_main
123 edhill 1.2 latex api_main
124     latex api_main
125     latex api_main
126 edhill 1.1
127 edhill 1.6 api_main.ps: api_main.dvi
128     dvips -Pcmz -Pamz -o api_main.ps api_main.dvi
129    
130     PDFOPTS = -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true
131     api_main.pdf: api_main.ps
132     ps2pdf \$(PDFOPTS) api_main.ps api_main.pdf
133    
134     all_protex: api_main.pdf
135 edhill 1.1
136 edhill 1.6 clean:
137     -rm -f *.aux *.dvi *.log *.toc *.out
138     -rm -f api_main.*
139 edhill 1.1 EOF
140    
141 edhill 1.6 printf "\t-rm -f " >> Makefile
142     cat ./.all_clean >> Makefile
143    
144 edhill 1.1 rm -f ./.dir_list_nocomments
145 edhill 1.2 rm -f ./.targets
146 edhill 1.6 rm -f ./.all_clean

  ViewVC Help
Powered by ViewVC 1.1.22