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 ###### diff --git a/Examples/ocaml/shapes/Makefile b/Examples/ocaml/shapes/Makefile index bc269d6d0..a9932793b 100644 --- a/Examples/ocaml/shapes/Makefile +++ b/Examples/ocaml/shapes/Makefile @@ -20,7 +20,7 @@ static: PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp -toplevel: +toplevel: static $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ diff --git a/Examples/ocaml/string_from_ptr/Makefile b/Examples/ocaml/string_from_ptr/Makefile index 0d3163e36..6917e4638 100644 --- a/Examples/ocaml/string_from_ptr/Makefile +++ b/Examples/ocaml/string_from_ptr/Makefile @@ -19,7 +19,7 @@ static: PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static -toplevel: +toplevel: static $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ diff --git a/Examples/ocaml/strings_test/Makefile b/Examples/ocaml/strings_test/Makefile index bed86841b..9474f5364 100644 --- a/Examples/ocaml/strings_test/Makefile +++ b/Examples/ocaml/strings_test/Makefile @@ -23,7 +23,7 @@ dynamic: PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp -toplevel: +toplevel: static $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ SWIG_LIB_DIR='$(SWIG_LIB_DIR)' SWIGEXE='$(SWIGEXE)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \