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.
This commit is contained in:
Gabriel Scherer 2018-08-25 14:56:27 +02:00
parent d09349f631
commit 80db356e9c
2 changed files with 20 additions and 7 deletions

11
.depend.menhir Normal file
View File

@ -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

View File

@ -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