RESDIR=./Fig %.v: %.H <$*.H Grey >/dev/null gainpanel=a pclip=100 title=$* out=$@ ${RESDIR}/images.v: image1.v image2.v image3.v vp_SideBySideAniso image1.v image2.v image3.v > $@We assume all ``.H'' files are already made. In the Make rule, we have the targets followed by a colon, then the dependencies. The next lines are indented and give the commands. Here we have two rules: one to make ``.v'' files from ``.H'' files and a second to combine the .v files into a single figure. The
%
are used as command line wild cards, $*
call
dependencies, such as RESDIR,
$@
is the target.
Now look at the same rule in SCons.
RESDIR= ``./Fig'' ResultER(RESDIR+'images.v',['image1.H','image2.H','image3.H'], ''' <${SOURCES[0]} Grey >/dev/null gainpanel=a pclip=100 title="Image 1" out=image1.v; <${SOURCES[1]} Grey >/dev/null gainpanel=a pclip=100 title="Image 2" out=image2.v; <${SOURCES[2]} Grey >/dev/null gainpanel=a pclip=100 title="Image 3" out=image3.v; vp_SideBySideAniso image1.v image2.v image3.v > ${TARGET} ''')In the SCons rule, we have combined both of the previous Make rules. In SCons, first you give the target (or list of targets) then the dependency (or list of dependencies) and then the commands. The triple quotes mean that the command is broken up into more than one line. We can replace a string with a variable. In this case,''./Fig'' has been replaced by RESDIR. Targets and sources can be referred to as
${SOURCES[i]}$
or ${TARGETS[i]}$
if there are
multiple sources or targets, where i is the position in the list on
the first line. If there is only on source or target they can be
called in the build rule as ${SOURCE}
or ${TARGET}
.
In Make there was no way to distinguish between different build objects except with the RESULTSER/RESULTSCR/RESULTSNR listed at the top of the Makefile. In SCons we adapted rules from RSF for different objects:
The Result commands are used to create anything that should not be removed when a clean is used. ResultER is an easily reproducible result. If there is any change in the rule or the dependency that figure will be rebuilt. ResultCR is a conditionally reproducible result that has one of the following properties: