aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-10-01 12:34:27 -0700
committerJohn MacFarlane <[email protected]>2022-10-01 12:34:27 -0700
commit20f82b0a8b47cdcdead0939a2c8fd2d459774fc7 (patch)
treeb8a2bcb91d157aebf370904da3e6951a0ce261a9
parentc51eeea4c7970652b91aa72b79fc9f46c01afecb (diff)
Makefile target to get module dependeny subgraphs.
E.g. what depends on Text.Pandoc.Parsing? make modules.pdf ROOTNODE=T.P.Parsing This is helpful for figuring out what we can split out as separate packages.
-rw-r--r--Makefile5
-rw-r--r--tools/cliptree.gvpr17
2 files changed, 21 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ab37439d6..9388c5d6f 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ COMMIT=$(shell git rev-parse --short HEAD)
TIMESTAMP=$(shell date "+%Y%m%d_%H%M")
LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv 2>/dev/null))
BASELINE?=$(LATESTBENCH)
+ROOTNODE?=T.P
ifeq ($(BASELINE),)
BASELINECMD=
else
@@ -174,8 +175,10 @@ modules.dot: $(SOURCEFILES)
| sed -e 's/Text\.Pandoc\([^ ]*\)/"T\.P\1"/g' >> $@
@echo "}" >> $@
+# To get the module dependencies of T.P.Parsing:
+# make modules.pdf ROOTNODE=T.P.Parsing
modules.pdf: modules.dot
- cat $< | dot -Tpdf > $@
+ gvpr -f tools/cliptree.gvpr -a '"$(ROOTNODE)"' $< | dot -Tpdf > $@
clean: ## clean up
cabal clean
diff --git a/tools/cliptree.gvpr b/tools/cliptree.gvpr
new file mode 100644
index 000000000..428cdfee5
--- /dev/null
+++ b/tools/cliptree.gvpr
@@ -0,0 +1,17 @@
+/* Construct subgraph reachable from node ARGV[0] by forward edges */
+BEG_G {
+ node_t r = node($,ARGV[0]);
+
+ $tvroot = r;
+ $tvtype = TV_fwd;
+ //print ("// Staring node: ", r.name);
+}
+N{
+ print ("// subgraph node: ", $.name);
+ $tvroot=NULL;
+ subnode($T,$);
+}
+E{
+ print ("// subgraph edge: ", $.name);
+ subedge($T,$);
+}