[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using make to create plots?




In article <Pine.OSF.3.96.1010601114509.32606B-100000@zuaxp0.star.ucl.ac.uk>, Stuart Colley <src@star.ucl.ac.uk> writes:
> hi,
> 
> I'm using make to create a LaTeX document that contains .eps files created
> by IDL.  What I'd like to do is have a suffix rule that checks to see if
> the .sav file (which contains the plot I created with IDL) is newer than
> the .eps that will be included in the document.  If the .sav file is newer
> than the .eps file then I'd like to create a new .eps from the .sav file
> using a routine I wrote:
> 
> sav2ps, 'filename.sav', /eps
> 
> The question is, can IDL be used to execute just one command, such as the
> one above is a suffix rule, e.g the one below:
> 
> ..SUFFIXES : .eps .sav
> ..sav.eps :
> 	idl sav2ps, 'filename.sav', /eps
> 
> Or would I have to create a .pro file with the relevant commands?  And
> could the make's $< macro be used to pass the filename - I have a feeling
> it couldn't.
> 
> cheers,
> S
> 

I think you would need at least a shell script as I can't see any way to get 
make to do what you want. IDL will read commands from the standard input and
in a script it can be made to read from a here-document within the script, but
I don't think you can have a make rule with a here-document.

So, e.g. create a file called 'script' with the contents:

idl << EOF
sav2ps,'$1',/eps
EOF


Then make your rule run the script:

.sav.eps :
	./script $<


-- 
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    nmw@ion.le.ac.uk 
Phone :     +44 (0)116 2523568, Fax : +44 (0)116 2523555