From 80db356e9ce8129385291f65a32fd20c7ac48ba2 Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Sat, 25 Aug 2018 14:56:27 +0200 Subject: [PATCH] add a .depend.menhir file for menhir parser dependencies We do not write to .depend during the common 'depend' target, because computing dependencies requires Menhir installed. --- .depend.menhir | 11 +++++++++++ Makefile.menhir | 16 +++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 .depend.menhir diff --git a/.depend.menhir b/.depend.menhir new file mode 100644 index 000000000..3b9e6e095 --- /dev/null +++ b/.depend.menhir @@ -0,0 +1,11 @@ +parsing/parser.cmo : parsing/syntaxerr.cmi parsing/parsetree.cmi \ + parsing/longident.cmi parsing/location.cmi parsing/docstrings.cmi \ + utils/clflags.cmi parsing/asttypes.cmi parsing/ast_helper.cmi \ + parsing/parser.cmi +parsing/parser.cmx : parsing/syntaxerr.cmx parsing/parsetree.cmi \ + parsing/longident.cmx parsing/location.cmx parsing/docstrings.cmx \ + utils/clflags.cmx parsing/asttypes.cmi parsing/ast_helper.cmx \ + parsing/parser.cmi +parsing/parser.cmi : parsing/parsetree.cmi parsing/location.cmi \ + parsing/docstrings.cmi +parsing/parser.ml parsing/parser.mli: parsing/ast_helper.cmi parsing/asttypes.cmi utils/clflags.cmi parsing/docstrings.cmi parsing/location.cmi parsing/longident.cmi parsing/parsetree.cmi parsing/syntaxerr.cmi diff --git a/Makefile.menhir b/Makefile.menhir index d839fcfcb..ee903085e 100644 --- a/Makefile.menhir +++ b/Makefile.menhir @@ -39,13 +39,6 @@ import-menhirLib: # is paired with an update of the imported menhirLib; otherwise it # would be easy to generate a parser and keep an incompatible version of # menhirLib, which would fail at compile-time. -# -# TODO review this in the wake of yacc parser's removal: -# # We assume that parser.ml and parser_menhir.ml depend -# # on the same modules, so that the dependency on -# # parsing/parser.cmo makes --infer work: the .cmi -# # of all modules that parser{_menhir}.mly semantic -# # actions depend on have already been built. promote-menhir: parsing/parser.mly $(MAKE) import-menhirLib $(MENHIR) $(MENHIRFLAGS) parsing/parser.mly @@ -64,3 +57,12 @@ partialclean-menhir:: $(addprefix parsing/camlinternalMenhirLib.,ml mli) clean-menhir: partialclean-menhir + +.PHONY: depend-menhir +depend-menhir: + $(MENHIR) --depend --ocamldep "$(CAMLDEP) -slash $(DEPFLAGS)" \ + parsing/parser.mly > .depend.menhir +# this rule depends on the variables CAMLDEP and DEPFLAGS +# define in Makefile, so it can only be invoked from the main Makefile + +include .depend.menhir