Skip to content

Commit

Permalink
add a .depend.menhir file for menhir parser dependencies
Browse files Browse the repository at this point in the history
We do not write to .depend during the common 'depend' target,
because computing dependencies requires Menhir installed.
  • Loading branch information
gasche committed Sep 1, 2018
1 parent d09349f commit 80db356
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .depend.menhir
Original file line number Diff line number Diff line change
@@ -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
16 changes: 9 additions & 7 deletions Makefile.menhir
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 80db356

Please sign in to comment.