From b092055ca87a9e6f9d489d967d2ff27870687ce4 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 26 Mar 2019 07:48:33 +0000 Subject: [PATCH] Fix parallel 'make check-ocaml-examples' Some versions of ocamlc create a file of the same name in the tmp directory when invoking using ocalmc on swigp4.ml. The name is the same even from different example directories. TMPDIR is a workaround to make ocamlc use a different directory for this temp file. Parallel make (-j) broke because different instances of ocamlc tried to create the same temp file. Issue #1503 --- Examples/Makefile.in | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 7022166a0..2688b16f3 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -865,12 +865,15 @@ NOLINK ?= false OCAMLPP= -pp "camlp4o ./swigp4.cmo" OCAMLP4WHERE=`$(COMPILETOOL) @CAMLP4@ -where` OCAMLCORE=\ - (test -f swig.mli || $(SWIG) -ocaml -co swig.mli 2>/dev/null) && \ - (test -f swig.ml || $(SWIG) -ocaml -co swig.ml 2>/dev/null) && \ - (test -f swigp4.ml || $(SWIG) -ocaml -co swigp4.ml 2>/dev/null) && \ - (test -f swig.cmi || $(OCC) -c swig.mli) && \ - (test -f swig.cmo || $(OCC) -c swig.ml) && \ - (test -f swigp4.cmi || $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml) + $(SWIG) -ocaml -co swig.mli 2>/dev/null && \ + $(SWIG) -ocaml -co swig.ml 2>/dev/null && \ + $(SWIG) -ocaml -co swigp4.ml 2>/dev/null && \ + $(OCC) -c swig.mli && \ + $(OCC) -c swig.ml && \ + mkdir -p ./localtmp && \ + env TMPDIR=./localtmp $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" -c swigp4.ml && \ + rm -rf ./localtmp +# TMPDIR above is a workaround for some ocamlc versions, such as 4.05.0, which always create a temp file of the same name breaking parallel make ocaml_static: $(SRCDIR_SRCS) $(OCAMLCORE) @@ -957,6 +960,7 @@ ocaml_clean: rm -f *_wrap* *~ .~* *.cmo *.cmi *.mli $(TARGET).ml $(RUNME) $(RUNME)_top swig.ml swigp4.ml rm -f core @EXTRA_CLEAN@ rm -f *.@OBJEXT@ *@SO@ + rm -rf ./localtmp ################################################################## ##### RUBY ######