The view rule updates and displays the results:
view : ${addsuffix .view, ${RESULTSALL}}
%.view: FORCE
if ${CANDO_GIF} ; then \
${MAKE} $*.viewgif ; \
elif ${CANDO_PS} ; then \
${MAKE} $*.viewps ; \
else \
echo "can't make $*.viewps $*viewgif";\
fi
RESULTSALL lists all result files and is defined as the
concatenation of RESULTSNR, RESULTSCR, and RESULTSER.
At our laboratory the %.view rule checks for the various formats of a result and chooses the first version the makefile knows how to generate. The variable CANDO contains the return value of a recursive gmake -n call. This return value indicates if that particular version of the result can be built. Having found a version that can be built, the %.view rule invokes another rule (%.viewgif or %.viewps) that updates and displays the result file:
%.viewgif : ${RESDIR}/%.gif FORCE
${XVIEW} ${UXVIEWFLAGS} ${RESDIR}/$*.gif
%.viewps : ${RESDIR}/%.ps FORCE
${GVIEW} ${UGVIEWFLAGS} ${RESDIR}/$*.ps
In the Frog example, the frog.view rule finds a rule for computing a .gif version of frog. Consequently, it invokes the gif rule frog.viewgif. In return frog.viewgif executes xview to display the result file frog.gif. If your computer system does not support the gif viewer xview, then you will need to supplement the %.viewgif rule with your own display command. Alternatively, frog.viewps executes ghostview to display the result file frog.ps.