#!/bin/sh set -e stem=$1 echo '# autogenerated' while read dgram args; do sed -e " s/BASE/STEM.dgram-DGRAM/g; s/STEM/$stem/g; s/DGRAM/$dgram/g; s/ARGS/$args/g; " <<'END' BASE.run-layout: STEM.d4 layout STEM.dgram.m printf '#!/bin/sh -ex\n$(LAYOUT) "$$@" %s $<\n' "ARGS" >$@.new chmod +x $@.new && mv -f $@.new $@ BASE.matrix-info: BASE.p0.segenco.ps matrix-demonstrate.ps sed -n '1,/^%L matrix here/p' matrix-demonstrate.ps >$@.ps.new sed -n '/^%L matrix begin/,/^%L matrix end/p' $< >>$@.ps.new sed -e '1,/^%L matrix here/d' matrix-demonstrate.ps >>$@.ps.new gs -sDEVICE=nullpage -dBATCH=1 -q $@.ps.new $o BASE.testui.ppm: BASE.pa.segenco.ppm pnmcrop -verbose 2>&1 <$< >$@.1.new | tee BASE.crop-info pnmflip <$@.1.new -ccw >$@.2.new pnmpad <$@.2.new -white -l5 -r5 -t5 -b5 $o BASE.overlay-info: genoverlayinfo \ BASE.plandata.c STEM.redacted.for-ui BASE.matrix-info ./$^ $(PLANUI_HEIGHT) $(PLANUI_PSDPI) $o END done