map.plag: generate-plag input-graph Parse.pm
./$< input-graph $o
-opt.plag: map.plag $(PLANAR_GRAPH)
- sha256sum $^ >.opt.plag.sums.tmp
- cmp .opt.plag.sums.tmp .opt.plag.sums || ( \
- $(PLANAR_GRAPH) RF $< \
+# create opt.plag.reuse to shortcut this
+opt.plag: maybe-rerun-optim map.plag $(PLANAR_GRAPH)
+ ./$^ $@ .opt.plag.sums \
+ R \
DUAL \
OUTER-F2V OUTER-SPLIT \
B T OUTER-F2V OUTER-F12VA \
PCO CP RAE \
- D 0 NLOPT \
+ D 0 NLOPT \
W $@.tmp \
- && $i \
- && mv -vf .opt.plag.sums.tmp .opt.plag.sums )
#map.ps: map.dot
# neato -Tps $^ $o
--- /dev/null
+#!/bin/bash
+set -e
+set -o posix
+set -o pipefail
+
+input=$1 ; shift
+planar_graph=$1 ; shift
+dest=$1 ; shift
+sums=$1 ; shift
+
+inst () { mv -vf $dest.tmp $dest; }
+
+if test -f $dest.reuse; then
+ cp -v $@.reuse $@.tmp
+ inst
+ exit 0
+fi
+
+sha256sum "$input" "$planar_graph" >$sums.tmp
+for arg in "$@"; do printf >>$sums.tmp "%s\n" "$arg"; done
+
+if cmp $sums.tmp $sums; then
+ exit 0
+fi
+
+"$planar_graph" <$input "$@"