aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaëtan Gilbert2018-11-10 19:52:19 +0100
committerGaëtan Gilbert2018-11-13 17:17:40 +0100
commitea68d3e92405760a453668c7f471e5c587884d80 (patch)
treea3acb1639fdf6c8d4a8b6cab8567235d9472d5c9
parent3e38d26233229d313d7a4c6015c7c15206c07305 (diff)
coq_makefile: Fix ocamldep ignoring mlg files
If you have file1.mlg and file2.ml, with file2 depending on file1, ocamldep was before generating file1.ml so wouldn't generate [file2.cmx: file1.cmx] (ocamldep is silent on non-found dependencies). This has been causing nondeterministic failures in quickchick recently. I guess it didn't come up in the past because ml4 files tend to be at the end of the dependency chain.
-rw-r--r--test-suite/coq-makefile/camldep/_CoqProject4
-rwxr-xr-xtest-suite/coq-makefile/camldep/run.sh17
-rw-r--r--tools/CoqMakefile.in3
3 files changed, 24 insertions, 0 deletions
diff --git a/test-suite/coq-makefile/camldep/_CoqProject b/test-suite/coq-makefile/camldep/_CoqProject
new file mode 100644
index 0000000000..0b7ebd14e4
--- /dev/null
+++ b/test-suite/coq-makefile/camldep/_CoqProject
@@ -0,0 +1,4 @@
+-Q . Foo
+-I src
+src/file1.mlg
+src/file2.ml
diff --git a/test-suite/coq-makefile/camldep/run.sh b/test-suite/coq-makefile/camldep/run.sh
new file mode 100755
index 0000000000..aa62ee56eb
--- /dev/null
+++ b/test-suite/coq-makefile/camldep/run.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+set -e
+export PATH=$COQBIN:$PATH
+export LC_ALL=C
+
+rm -rf _test
+mkdir _test
+cp _CoqProject _test/
+cd _test
+mkdir src
+
+echo '{ let foo = () }' > src/file1.mlg
+echo 'let bar = File1.foo' > src/file2.ml
+coq_makefile -f _CoqProject -o Makefile
+make src/file2.cmx
+[ -f src/file2.cmx ]
diff --git a/tools/CoqMakefile.in b/tools/CoqMakefile.in
index e3fa0c24fe..92cc820483 100644
--- a/tools/CoqMakefile.in
+++ b/tools/CoqMakefile.in
@@ -719,6 +719,9 @@ endif
redir_if_ok = > "$@" || ( RV=$$?; rm -f "$@"; exit $$RV )
+GENMLFILES:=$(MLGFILES:.mlg=.ml) $(ML4FILES:.ml4=.ml)
+$(addsuffix .d,$(ALLSRCFILES)): $(GENMLFILES)
+
$(addsuffix .d,$(MLIFILES)): %.mli.d: %.mli
$(SHOW)'CAMLDEP $<'
$(HIDE)$(CAMLDEP) $(OCAMLLIBS) "$<" $(redir_if_ok)