make: invoke command for multiple targets of multiple files?
Posted
by marvin2k
on Stack Overflow
See other posts from Stack Overflow
or by marvin2k
Published on 2010-05-21T09:36:33Z
Indexed on
2010/05/21
9:40 UTC
Read the original article
Hit count: 261
Hi,
I looking to optimize an existing Makefile. It's used to create multiple plots (using Octave) for every logfile in a given directory using an scriptfile for every plot which takes a logfilename as an argument. In the Moment, I use one single rule for every kind of plot available, with a handwritten call to Octave, giving the specific scriptfile/logfile as an argument.
It would be nice, if every plot has "his" octave-script as a dependency (plus the logfile, of course), so only one plot is regenerated if his script is changed.
Since I don't want to type that much, I wonder how I can simplifiy this by using only one general rule to build "a" plot?
To make it clearer:
- Logfile: "$(LOGNAME).log"
- Scriptfile: "plot$(PLOTNAME).m" creates "$(LOGNAME)_$(PLOTNAME).png"
The first thing I had in mind:
%1_%2.png: %1.log
$(OCTAVE) --eval "plot$<2('$<1')"
But this seems not to be allowed. Could someone give me a hint?
© Stack Overflow or respective owner