#!/bin/tcsh #This document uses 2-character tab spaces. #The ANSI colo[u]rs are useful: you can type "m prog; prog" and if the compilation fails, the program[me]'s output will be in red ... if ( $# == 0 ) then echo '' echo '-------------------------------------------------------------------------' echo 'Universal Make, V0.0 2005-09-30' echo 'Usage:' echo ' m tsource Run LaTeX, BibTeX and dvips on tsource.tex' echo ' m texformula Turn a small file texformula.tex into EPS with TIFF preview echo ' m csource Run g++ on csource.cc' echo ' m jsource Run javac on jsource.java' echo ' m clean Remove junk files' echo 'Extensions are automatically detected in the order above.' echo ' ' echo 'Suggested setup:' echo '1. Create a "bin" directory somewhere.' echo '2. Insert the following into ~/.cshrc (if you use csh): setenv PATH ${PATH}:somewhere/bin' echo '3. Put this "m" file into the bin directory and do "chmod a+x m".' echo '4. Do "rehash" and "source ~/.cshrc". Then this will be ready to use.' echo '-------------------------------------------------------------------------' echo '' else if ( $1 == 'clean' ) then echo '' echo '-------------------------------------------------------------------------' echo 'Universal Clean, V0.0 2005-09-30' echo set filelist="*.cb *.log *.mtc *.mtc1 *.toc *.aux *.bak *.bbl *.blg *.end *.*~ *.*#" echo $filelist echo echo 'Please enter capital Y to remove the above files:' set answer=$< if ( $answer == 'Y' ) then rm -fv $filelist endif echo '' else if (-e $1.tex) then echo '' echo 'Processing LaTeX source:' latex $1; if ( $? != 0 ) goto ERROR bibtex $1; set bibtexstatus=$? latex $1; if ( $? != 0 ) goto ERROR latex $1; if ( $? != 0 ) goto ERROR dvips $1 -o;if ( $? != 0 ) goto ERROR if ( $bibtexstatus != 0 ) echo 'BibTeX failed ------- references may not be right.' echo '' else if (-e $1.texf) then echo '' echo 'Turning .texf into .eps with embedded TIFF preview: (ignore the error message)' echo 'At the moment the final graphic comes out a bit stretched vertically.' pdflatex $1.texf; if ( $? != 0 ) goto ERROR convert $1.pdf $1.temp.eps; if ( $? != 0 ) goto ERROR epstool -t6p --dpi 300 $1.temp.eps $1.eps; if ( $? != 0 ) goto ERROR echo '' else if (-e $1.cc) then echo '' echo 'Compiling and linking C++ source code:' g++ -O3 $1.cc -o $1; if ( $? != 0 ) goto ERROR echo ''; else if (-e $1.java) then echo '' echo 'Compiling Java source code to produce class file:' javac $1.java; if ( $? != 0 ) goto ERROR echo ''; else echo "No suitable file of the name $1!" endif exit ERROR: echo ''"ERROR ENCOUNTERED WHILE PROCESSING $1!"