#!@SHELL@ BIN_DIR=@BINDIR@ SML=$BIN_DIR/sml mf="" xx=$$ tmpmf=$xx-makefile mlscript=$xx-mlscript.sml thisscript=$0 trap 'rm -f $tmpmf $mlscript' 0 1 2 3 15 usage() { echo $thisscript: $* echo Usage: $thisscript '[-f makefile]' cmfile targetname exit 1 } # # process -f option if it is given # if [ $# != 0 ] ; then if [ "$1" = "-f" ] ; then shift if [ $# = 0 ] ; then usage else mf=$1 shift if [ -f "$mf" ] ; then : ok else echo $thisscript: $mf does not exist exit 1 fi fi fi fi # # if there was no -f option, check for makefile and then Makefile # if [ x$mf = x ] ; then if [ -f makefile ] ; then mf=makefile elif [ -f Makefile ] ; then mf=Makefile else echo $thisscript: no makefile, no Makefile, and no -f option exit 1 fi fi # # get the two mandatory arguments # if [ $# = 2 ] ; then cmfile=$1 target=$2 else usage fi # # the delimiter strings (start and end) # delims="# START: ml-makedepend (${cmfile}:${target}); DO NOT DELETE!" delime="# END : ml-makedepend (${cmfile}:${target}); DO NOT DELETE!" # # remove previous result of ml-makedepend # (other cmfile/target combinations are unaffected) # awk "BEGIN { c = 1; s = \"${delims}\"; e = \"${delime}\"; } (\$0 == s) { c = 0; continue; } (\$0 == e) { c = 1; continue; } (c == 1) { print }" <$mf >$tmpmf cp $tmpmf $mf rm $tmpmf # # construct the ML script # cat >$mlscript < ignore (OS.Process.exit OS.Process.failure) | SOME l => let val s = TextIO.openOut "$tmpmf" fun pr { derived = true, file, class } = () | pr { file, ... } = TextIO.output (s, " \\\\\\n " ^ file) in TextIO.output (s, "${delims}\\n${target}:"); app pr l; TextIO.output (s, "\\n${delime}\\n"); TextIO.closeOut s; ignore (OS.Process.exit OS.Process.success) end end stop if $SML '$smlnj/cm.cm' $mlscript >/dev/null 2>&1 ; then cat $tmpmf >>$mf else echo $thisscript: CM dependency analysis failed exit 1 fi exit 0
Click to toggle
does not end with </html> tag
does not end with </body> tag
The output has ended thus: cat $tmpmf >>$mf else echo $thisscript: CM dependency analysis failed exit 1 fi exit 0