summaryrefslogtreecommitdiff
path: root/Makefile.menhir
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2018-09-06 14:24:10 +0200
committerGabriel Scherer <gabriel.scherer@gmail.com>2018-09-06 19:06:09 +0200
commitf359bf527d9f197a145f37f166299a2af0a187f7 (patch)
tree7f1abde567b6aa0aff068ceccb4e07180af29485 /Makefile.menhir
parent0a05dc83825c93b219c1e0d635d243e27cb51bca (diff)
downloadocaml-f359bf527d9f197a145f37f166299a2af0a187f7.tar.gz
Makefile.menhir: sanitize the standard.mly path to avoid useless churn
Tested by François Pottier.
Diffstat (limited to 'Makefile.menhir')
-rw-r--r--Makefile.menhir11
1 files changed, 10 insertions, 1 deletions
diff --git a/Makefile.menhir b/Makefile.menhir
index adf39fced3..e8bc88ec11 100644
--- a/Makefile.menhir
+++ b/Makefile.menhir
@@ -63,7 +63,16 @@ MENHIRFLAGS := --explain --ocamlc "$(CAMLC) $(COMPFLAGS)" --infer\
promote-menhir: parsing/parser.mly
$(MAKE) import-menhirLib
$(MENHIR) $(MENHIRFLAGS) parsing/parser.mly
- cp $(addprefix parsing/parser.,ml mli) boot/menhir
+# The generated parser.ml may contain lexer directives containing
+# the absolute path to Menhir's standard library on the promoter's machine.
+# This is benign but will generate pointless churn if another developer
+# rebuilds the same grammar (from the same Menhir version).
+ for f in $(addprefix parser.,ml mli) ; do \
+ sed \
+ 's,^#\(.*\)"[^"]*/menhir/standard.mly",#\1"menhir/standard.mly",g' \
+ parsing/$$f \
+ > boot/menhir/$$f; \
+ done
# The import-menhirLib invocation in promote-menhir ensures that each
# update of the boot/ parser is paired with an update of the imported