From 7a5cc8f42c62035bf516e96500457c9fca922ab7 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Wed, 13 Apr 2016 18:19:18 -0700 Subject: [PATCH] Add make target for module dependency graph Summary:public This extends infer/src/Makefile with a mod_dep.dot target that builds a dot graph of module dependencies. This also adds ocamldot, which is in the public domain and available from http://trevorjim.com/projects/ocamldot/ocamldot.tar . Reviewed By: cristianoc Differential Revision: D3168488 fb-gh-sync-id: 267fb0e fbshipit-source-id: 267fb0e --- .gitignore | 3 +++ Makefile.in | 1 + infer/src/Makefile.in | 14 ++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/.gitignore b/.gitignore index 63a7c737c..89682b7c4 100644 --- a/.gitignore +++ b/.gitignore @@ -123,3 +123,6 @@ buck-out/ /infer/annotations/processor_classes/ /infer/lib/java/processor.jar infer/src/.project +/dependencies/ocamldot/ocamldot +/dependencies/ocamldot/ocamldot.ml +/infer/src/mod_dep.dot diff --git a/Makefile.in b/Makefile.in index a0808fdb2..32461b2f0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -150,6 +150,7 @@ test: $(MAKE) -C $(INFER_DIR) $(INFER_BIN) $(MAKE) -C $(SRC_DIR) init $(MAKE) -j$(NCPU) test_build + $(MAKE) -C $(SRC_DIR) mod_dep.dot $(MAKE) ocaml_unit_test buck_test inferTraceBugs_test test_xml: buck_test_xml diff --git a/infer/src/Makefile.in b/infer/src/Makefile.in index 37b8c1974..05bfe9f55 100644 --- a/infer/src/Makefile.in +++ b/infer/src/Makefile.in @@ -192,6 +192,19 @@ test_build: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_ $(INFERUNIT_MAIN).byte \ $(CHECKCOPYRIGHT_MAIN).byte +$(DEPENDENCIES_DIR)/ocamldot/ocamldot: + $(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot + +roots:=Inferanalyze CMain JMain Inferprint +src_dirs:=$(shell find * -type d) +src_files:=$(shell find $(src_dirs) -regex '.*\.ml\(i\)*' -not -path facebook/scripts/eradicate_stats.ml) +inc_flags:=$(foreach dir,$(src_dirs),-I $(dir)) +root_flags:=$(foreach root,$(roots),-r $(root)) +mod_dep.dot: $(DEPENDENCIES_DIR)/ocamldot/ocamldot $(src_files) + ocamldep.opt $(inc_flags) $(src_files) \ + | $(DEPENDENCIES_DIR)/ocamldot/ocamldot -lr $(root_flags) \ + > mod_dep.dot + ifeq (@ENABLE_OCAML_ANNOT@,yes) java_annotations: build_java rsync -a --include '*/' --include '*.annot' --exclude '*' $(JAVA_BUILD_DIR)/ $(ANNOT_DIR)/ @@ -312,3 +325,4 @@ endif $(REMOVE) $(INFERANALYZE_BIN) $(INFERPRINT_BIN) $(CHECKCOPYRIGHT_BIN) $(REMOVE) $(CLANG_ATDGEN_STUBS) $(REMOVE) $(INFER_CLANG_FCP_MIRRORED_FILES) + $(REMOVE) mod_dep.dot