#! /usr/bin/env sh # # $Header: /home/ubuntu/mnt/e9_copy/MITgcm/doc/api_reference/configure,v 1.6 2004/04/01 05:34:41 edhill Exp $ # # A script to generate the Makefile for the API Reference if ! test -r ./dir_list ; then cat < ./.dir_list_nocomments name=$0 cat < Makefile # # ================================================ # # CREATED BY "$name" -- DO NOT EDIT !!! # # ================================================ # .SUFFIXES: all: all_protex EOF rm -rf ./.targets ./.all_clean cat ./.dir_list_nocomments | while read line ; do echo >> Makefile base_target=`echo $line | awk '{print $1}' | sed -e 's|/|__|g'` target=$base_target".tex" printf " $target" >> ./.all_clean echo "Finding files for \"$target\" in: $line" tex_files="" h_files="" F_files="" c_files="" for i in $line ; do tex_files="$tex_files"`ls -1 ../../$i/*.tex 2>/dev/null` h_files="$h_files"`ls -1 ../../$i/*.h 2>/dev/null` F_files="$F_files"`ls -1 ../../$i/*.F 2>/dev/null` c_files="$c_files"`ls -1 ../../$i/*.c 2>/dev/null` done # *.tex printf '%s' $base_target"_tex = " >> Makefile for i in $tex_files ; do printf '\\\n%s' " $i " >> Makefile done printf '\n' >> Makefile # *.h printf '%s' $base_target"_h = " >> Makefile for i in $h_files ; do printf '\\\n%s' " $i " >> Makefile done printf '\n' >> Makefile # *.F printf '%s' $base_target"_F = " >> Makefile for i in $F_files ; do printf '\\\n%s' " $i " >> Makefile done printf '\n' >> Makefile # *.c printf '%s' $base_target"_c = " >> Makefile for i in $c_files ; do printf '\\\n%s' " $i " >> Makefile done printf '\n' >> Makefile d_tex="\$("$base_target"_tex)" d_h="\$("$base_target"_h)" d_F="\$("$base_target"_F)" d_c="\$("$base_target"_c)" cat <> Makefile $target: $d_tex $d_h $d_F $d_c -rm -f $target EOF if test ! "x$tex_files" = x ; then printf '\t%s\n' "-cat $d_tex >> $target" >> Makefile fi if test ! "x$h_files" = x ; then printf '\t%s\n' "-./protex -b7f $d_h >> $target" >> Makefile fi if test ! "x$F_files" = x ; then printf '\t%s\n' "-./protex -b7f $d_F >> $target" >> Makefile fi if test ! "x$c_files" = x ; then printf '\t%s\n' "-./protex -bCf $d_c >> $target" >> Makefile fi if test ! "x$target" = x ; then printf '%s' " $target" >> ./.targets fi done alltex=`cat ./.targets` printf '\n%s' "ALLTEX = " >> Makefile for i in $alltex ; do printf '\\\n%s' " $i " >> Makefile done printf '\n\n' >> Makefile cat <> Makefile makefile: $0 api_main.tex: introduction.tex \$(ALLTEX) -./build_main \$(ALLTEX) api_main.dvi: api_main.tex latex api_main latex api_main latex api_main latex api_main api_main.ps: api_main.dvi dvips -Pcmz -Pamz -o api_main.ps api_main.dvi PDFOPTS = -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true api_main.pdf: api_main.ps ps2pdf \$(PDFOPTS) api_main.ps api_main.pdf all_protex: api_main.pdf clean: -rm -f *.aux *.dvi *.log *.toc *.out -rm -f api_main.* EOF printf "\t-rm -f " >> Makefile cat ./.all_clean >> Makefile rm -f ./.dir_list_nocomments rm -f ./.targets rm -f ./.all_clean