diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f2fcbc38cdd5589c5a3425750f4c97df60fcc325..bb898623219456e35f84ea9c81ab655f3084fd64 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,7 +29,7 @@ variables:
 build-coq.dev:
   <<: *template
   variables:
-    BUILD_TARGET: "ref" # don't check test output
+    MAKE_REF: "1" # don't check test output
     OPAM_PINS: "coq version dev"
     VALIDATE: "1"
 
diff --git a/Makefile.coq.local b/Makefile.coq.local
index 713aeb5f34246a2e312a0eff528319f27abe26d6..3f0f97e4d68722cfd6b9cf972eb415eda52d4f94 100644
--- a/Makefile.coq.local
+++ b/Makefile.coq.local
@@ -19,24 +19,14 @@ tests/.coqdeps.d: $(TESTFILES)
 	$(HIDE)$(COQDEP) -dyndep var $(COQMF_COQLIBS_NOML) $^ $(redir_if_ok)
 -include tests/.coqdeps.d
 
-$(TESTFILES:.v=.vo): %.vo: %.v
+$(TESTFILES:.v=.vo): %.vo: %.v $(if $(MAKE_REF),,%.ref)
 	$(SHOW)COQTOP [test] $<
 	$(HIDE)TEST="$$(basename -s .v $<)" && \
 	  TMPFILE="$$(mktemp)" && \
 	  $(TIMER) $(COQ_TEST) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< $(TIMING_EXTRA) > "$$TMPFILE" && \
 	  ($(REF_FILTER) < "$$TMPFILE" > "$$TMPFILE.filtered" || true) && \
-	  (diff -u "tests/$$TEST.ref" "$$TMPFILE.filtered" || rm -f "tests/$$TEST.vo" "$$TMPFILE" "$$TMPFILE.filtered") && \
-	  rm "$$TMPFILE" "$$TMPFILE.filtered" && \
+	  $(if $(MAKE_REF), \
+	    mv "$$TMPFILE.filtered" "tests/$$TEST.ref", \
+	    diff -u "tests/$$TEST.ref" "$$TMPFILE.filtered") && \
+	  rm -f "$$TMPFILE" "$$TMPFILE.filtered" && \
 	  touch $@
-
-# a target, for convenience sake, to create the .ref file with the current output
-ref: $(TESTFILES:.v=.ref)
-.PHONY: ref
-
-# coqdep doesn't emit dependencies for these so we just depend on everything
-tests/%.ref: tests/%.v $(VFILES:.v=.vo)
-	$(SHOW)COQTOP [ref] $<
-	$(HIDE)TEST="$$(basename -s .v $<)" && \
-	  $(TIMER) $(COQ_TEST) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) -load-vernac-source $< $(TIMING_EXTRA) > "tests/$$TEST.ref" && \
-	  ($(REF_FILTER) < "tests/$$TEST.ref" > "tests/$$TEST.ref.filtered" || true) && \
-	  mv "tests/$$TEST.ref.filtered" "tests/$$TEST.ref"
diff --git a/README.md b/README.md
index 2dcd5cd75f49da63f3e2cc9cc64420e3e4e2cac6..9a546db396b54d389856faeaa0df959eac6b8c8d 100644
--- a/README.md
+++ b/README.md
@@ -118,6 +118,6 @@ The files in `tests/` are test cases.  Each of the `.v` files comes with a
 matching `.ref` file containing the expected output of `coqc`.  Adding `Show.`
 in selected places in the proofs makes `coqc` print the current goal state.
 This is used to make sure the proof mode prints goals and reduces terms the way
-we expect it to.  You can run `make ref` to re-generate all the `.ref` files;
+we expect it to.  You can run `MAKE_REF=1 make` to re-generate all the `.ref` files;
 this is useful after adding or removing `Show.` from a test.  If you do this,
 make sure to check the diff for any unexpected changes in the output!
diff --git a/ci b/ci
index 16c8b6107119db3448b6828d3d2757888f2b2376..8ec855ae44ec77fa7ce4e13101c6a08441d3abba 160000
--- a/ci
+++ b/ci
@@ -1 +1 @@
-Subproject commit 16c8b6107119db3448b6828d3d2757888f2b2376
+Subproject commit 8ec855ae44ec77fa7ce4e13101c6a08441d3abba