aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-10-01 11:52:54 -0700
committerJohn MacFarlane <[email protected]>2022-10-01 11:52:54 -0700
commitc51eeea4c7970652b91aa72b79fc9f46c01afecb (patch)
tree47b9b44a4e857991b46a6042bdd73ccf0d9cd166
parent4e29d6d379436b43f5eb2e9fee695b5f397e34f2 (diff)
Add Makefile target to create a directed graph of module dependencies.
-rw-r--r--Makefile16
1 files changed, 16 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 10aa86206..ab37439d6 100644
--- a/Makefile
+++ b/Makefile
@@ -161,6 +161,22 @@ update-website: ## update website and upload
make -C $(WEBSITE) upload
.PHONY: update-website
+modules.dot: $(SOURCEFILES)
+ @echo "digraph G {" > $@
+ @echo "overlap=\"scale\"" >> $@
+ @rg '^import.*Text\.Pandoc\.' --with-filename src \
+ | rg -v 'Text\.Pandoc\.(Definition|Builder|Walk|Generic)' \
+ | sort \
+ | uniq \
+ | sed -e 's/src\///' \
+ | sed -e 's/\//\./g' \
+ | sed -e 's/\.hs:import *\(qualified *\)*\([^ ]*\).*/ -> \2/' \
+ | sed -e 's/Text\.Pandoc\([^ ]*\)/"T\.P\1"/g' >> $@
+ @echo "}" >> $@
+
+modules.pdf: modules.dot
+ cat $< | dot -Tpdf > $@
+
clean: ## clean up
cabal clean
.PHONY: clean