Back to home page

MITgcm

 
 

    


Warning, /doc/old_doc/api_reference/configure is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit ad38444b on 2018-01-31 20:35:48 UTC
cedb4b86df Ed H*0001 #! /usr/bin/env sh
                0002 #
                0003 #
                0004 #  A script to generate the Makefile for the API Reference
                0005 
                0006 if ! test -r ./dir_list ; then
                0007     cat <<EOF 
                0008 ERROR: cannot read the directory list -- please verify that this 
                0009   script is run in MITGCM_ROOT/doc/api_reference and that the 
                0010   "dir_list" file is readable.
                0011 EOF
                0012     exit 1
                0013 fi
                0014 
                0015 cat ./dir_list | grep -v '^[ ]*#' | grep -v '^[ ]*$' > ./.dir_list_nocomments
                0016 
                0017 name=$0
                0018 cat <<EOF > Makefile
                0019 #
d5d5c6127e Ed H*0020 #  ================================================
5f36ff9e77 Ed H*0021 #
d5d5c6127e Ed H*0022 #  CREATED BY "$name" -- DO NOT EDIT !!!
cedb4b86df Ed H*0023 #
d5d5c6127e Ed H*0024 #  ================================================
5f36ff9e77 Ed H*0025 #
                0026 
                0027 .SUFFIXES:
cedb4b86df Ed H*0028 
                0029 all: all_protex
                0030 
                0031 EOF
                0032 
fb6befa5e7 Ed H*0033 rm -rf ./.targets ./.all_clean
cedb4b86df Ed H*0034 cat ./.dir_list_nocomments | while read line ; do
                0035 
                0036     echo >> Makefile
                0037     base_target=`echo $line | awk '{print $1}' | sed -e 's|/|__|g'`
                0038     target=$base_target".tex"
fb6befa5e7 Ed H*0039     printf " $target" >> ./.all_clean
cedb4b86df Ed H*0040     echo "Finding files for \"$target\" in: $line"
d5d5c6127e Ed H*0041     tex_files=""
cedb4b86df Ed H*0042     h_files=""
d5d5c6127e Ed H*0043     F_files=""
cedb4b86df Ed H*0044     c_files=""
                0045     for i in $line ; do
d5d5c6127e Ed H*0046         tex_files="$tex_files"`ls -1 ../../$i/*.tex  2>/dev/null`
cedb4b86df Ed H*0047         h_files="$h_files"`ls -1 ../../$i/*.h  2>/dev/null`
d5d5c6127e Ed H*0048         F_files="$F_files"`ls -1 ../../$i/*.F  2>/dev/null`
cedb4b86df Ed H*0049         c_files="$c_files"`ls -1 ../../$i/*.c  2>/dev/null`
                0050     done
                0051 
d5d5c6127e Ed H*0052     # *.tex
                0053     printf '%s' $base_target"_tex = " >> Makefile
                0054     for i in $tex_files ; do
cedb4b86df Ed H*0055         printf '\\\n%s' " $i " >> Makefile
                0056     done
                0057     printf '\n' >> Makefile
                0058 
                0059     # *.h
                0060     printf '%s' $base_target"_h = " >> Makefile
                0061     for i in $h_files ; do
                0062         printf '\\\n%s' " $i " >> Makefile
                0063     done
                0064     printf '\n' >> Makefile
                0065 
d5d5c6127e Ed H*0066     # *.F
                0067     printf '%s' $base_target"_F = " >> Makefile
                0068     for i in $F_files ; do
                0069         printf '\\\n%s' " $i " >> Makefile
                0070     done
                0071     printf '\n' >> Makefile
                0072 
cedb4b86df Ed H*0073     # *.c
                0074     printf '%s' $base_target"_c = " >> Makefile
                0075     for i in $c_files ; do
                0076         printf '\\\n%s' " $i " >> Makefile
                0077     done
                0078     printf '\n' >> Makefile
d5d5c6127e Ed H*0079     d_tex="\$("$base_target"_tex)"
cedb4b86df Ed H*0080     d_h="\$("$base_target"_h)"
d5d5c6127e Ed H*0081     d_F="\$("$base_target"_F)"
cedb4b86df Ed H*0082     d_c="\$("$base_target"_c)"
                0083     cat <<EOF >> Makefile
d5d5c6127e Ed H*0084 $target: $d_tex $d_h $d_F $d_c
cedb4b86df Ed H*0085         -rm -f $target
                0086 EOF
d5d5c6127e Ed H*0087     if test ! "x$tex_files" = x ; then
                0088         printf '\t%s\n' "-cat $d_tex >> $target" >> Makefile
cedb4b86df Ed H*0089     fi
                0090     if test ! "x$h_files" = x ; then
d885515f4e Ed H*0091         printf '\t%s\n' "-./protex -b7f $d_h >> $target" >> Makefile
cedb4b86df Ed H*0092     fi
d5d5c6127e Ed H*0093     if test ! "x$F_files" = x ; then
d885515f4e Ed H*0094         printf '\t%s\n' "-./protex -b7f $d_F >> $target" >> Makefile
d5d5c6127e Ed H*0095     fi
cedb4b86df Ed H*0096     if test ! "x$c_files" = x ; then
d885515f4e Ed H*0097         printf '\t%s\n' "-./protex -bCf $d_c >> $target" >> Makefile
cedb4b86df Ed H*0098     fi
                0099 
                0100     if test ! "x$target" = x ; then
                0101         printf '%s' " $target" >> ./.targets
                0102     fi
                0103 done
                0104 
                0105 alltex=`cat ./.targets`
                0106 printf '\n%s' "ALLTEX = " >> Makefile
                0107 for i in $alltex ; do
                0108     printf '\\\n%s' " $i " >> Makefile
                0109 done
                0110 printf '\n\n' >> Makefile
                0111 
                0112 cat <<EOF >> Makefile
                0113 
                0114 makefile:
                0115         $0
                0116 
52c38edbc1 Ed H*0117 api_main.tex: introduction.tex \$(ALLTEX)
5f36ff9e77 Ed H*0118         -./build_main \$(ALLTEX)
cedb4b86df Ed H*0119 
5f36ff9e77 Ed H*0120 api_main.dvi:  api_main.tex
                0121         latex api_main
fefe253d88 Dimi*0122         bibtex api_main
5f36ff9e77 Ed H*0123         latex api_main
d5d5c6127e Ed H*0124         latex api_main
cedb4b86df Ed H*0125 
fb6befa5e7 Ed H*0126 api_main.ps: api_main.dvi
                0127         dvips -Pcmz -Pamz -o api_main.ps api_main.dvi
                0128 
                0129 PDFOPTS = -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true 
                0130 api_main.pdf: api_main.ps
                0131         ps2pdf \$(PDFOPTS) api_main.ps api_main.pdf
                0132 
                0133 all_protex: api_main.pdf
cedb4b86df Ed H*0134 
5eef09f930 Ed H*0135 distclean:
                0136         @make clean
                0137         -rm -f Makefile
                0138 
2d709368bb Ed H*0139 install: all
                0140         -rm -rf ./api_ref
                0141         mkdir ./api_ref
                0142         -cp api_main.pdf ./api_ref/api_ref.pdf
                0143         scp -r ./api_ref mitgcm.org:/u/u0/httpd/html/
                0144 
fb6befa5e7 Ed H*0145 clean:
                0146         -rm -f *.aux *.dvi *.log *.toc *.out
                0147         -rm -f api_main.*
cedb4b86df Ed H*0148 EOF
                0149 
fb6befa5e7 Ed H*0150 printf "\t-rm -f " >> Makefile
                0151 cat ./.all_clean >> Makefile
                0152 
cedb4b86df Ed H*0153 rm -f ./.dir_list_nocomments
5f36ff9e77 Ed H*0154 rm -f ./.targets
fb6befa5e7 Ed H*0155 rm -f ./.all_clean