diff --git a/Makefile b/Makefile index 0632dece5..a4379a44f 100644 --- a/Makefile +++ b/Makefile @@ -283,15 +283,18 @@ BOOT_FLEXLINK_CMD= ifeq "$(UNIX_OR_WIN32)" "win32" FLEXDLL_SUBMODULE_PRESENT := $(wildcard flexdll/Makefile) ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" - BOOT_FLEXLINK_CMD= - FLEXDLL_DIR= + BOOT_FLEXLINK_CMD = + FLEXDLL_DIR = + FLEXLINK_ENV = else BOOT_FLEXLINK_CMD = FLEXLINK_CMD="../boot/ocamlrun ../flexdll/flexlink.exe" - CAMLOPT := OCAML_FLEXLINK="boot/ocamlrun flexdll/flexlink.exe" $(CAMLOPT) + # FLEXLINK_ENV must have a space at the end + FLEXLINK_ENV = OCAML_FLEXLINK="boot/ocamlrun flexdll/flexlink.exe" # FLEXDLL_DIR=$(if $(wildcard flexdll/flexdll_*.$(O)),+flexdll) endif else - FLEXDLL_DIR= + FLEXDLL_DIR = + FLEXLINK_ENV = endif # The configuration file @@ -879,7 +882,7 @@ partialclean:: ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \ $(BYTESTART:.cmo=.cmx) - $(CAMLOPT) $(LINKFLAGS) -o $@ $^ -cclib "$(BYTECCLIBS)" + $(FLEXLINK_ENV)$(CAMLOPT) $(LINKFLAGS) -o $@ $^ -cclib "$(BYTECCLIBS)" partialclean:: rm -f ocamlc.opt @@ -893,7 +896,7 @@ partialclean:: ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ $(OPTSTART:.cmo=.cmx) - $(CAMLOPT) $(LINKFLAGS) -o $@ $^ + $(FLEXLINK_ENV)$(CAMLOPT) $(LINKFLAGS) -o $@ $^ partialclean:: rm -f ocamlopt.opt @@ -1286,7 +1289,7 @@ ocamlnat$(EXE): compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \ compilerlibs/ocamlbytecomp.cmxa \ compilerlibs/ocamlopttoplevel.cmxa \ $(OPTTOPLEVELSTART:.cmo=.cmx) - $(CAMLOPT) $(LINKFLAGS) -linkall -o $@ $^ + $(FLEXLINK_ENV)$(CAMLOPT) $(LINKFLAGS) -linkall -o $@ $^ partialclean:: rm -f ocamlnat$(EXE) diff --git a/lex/Makefile b/lex/Makefile index 8e8b0fd43..0121a6a61 100644 --- a/lex/Makefile +++ b/lex/Makefile @@ -21,9 +21,11 @@ CAMLYACC ?= ../yacc/ocamlyacc ROOTDIR=.. ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" -export OCAML_FLEXLINK:= +FLEXLINK_ENV = else -export OCAML_FLEXLINK:=$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe +# FLEXLINK_ENV must have a space at the end +FLEXLINK_ENV = \ + OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" # endif CAMLC=$(CAMLRUN) ../boot/ocamlc -strict-sequence -nostdlib -I ../boot \ @@ -49,7 +51,7 @@ ocamllex: $(OBJS) $(CAMLC) $(LINKFLAGS) -compat-32 -o ocamllex $(OBJS) ocamllex.opt: $(OBJS:.cmo=.cmx) - $(CAMLOPT) -o ocamllex.opt $(OBJS:.cmo=.cmx) + $(FLEXLINK_ENV)$(CAMLOPT) -o ocamllex.opt $(OBJS:.cmo=.cmx) clean:: rm -f ocamllex ocamllex.opt diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile index 376702374..db8960af2 100644 --- a/ocamldoc/Makefile +++ b/ocamldoc/Makefile @@ -23,15 +23,17 @@ OCAMLYACC ?= $(ROOTDIR)/yacc/ocamlyacc STDLIBFLAGS = -nostdlib -I $(ROOTDIR)/stdlib OCAMLC = $(OCAMLRUN) $(ROOTDIR)/ocamlc $(STDLIBFLAGS) -ifeq "$(UNIX_OR_WIN32)" "unix" OCAMLOPT = $(OCAMLRUN) $(ROOTDIR)/ocamlopt $(STDLIBFLAGS) +ifeq "$(UNIX_OR_WIN32)" "unix" +FLEXLINK_ENV = else # Windows ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" - FLEXLINK_ENV= + FLEXLINK_ENV = else - FLEXLINK_ENV=OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" + # FLEXLINK_ENV must have a space at the end + FLEXLINK_ENV = \ + OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" # endif - OCAMLOPT = $(FLEXLINK_ENV) $(OCAMLRUN) $(ROOTDIR)/ocamlopt $(STDLIBFLAGS) endif OCAMLDEP = $(OCAMLRUN) $(ROOTDIR)/tools/ocamldep -slash OCAMLLEX = $(OCAMLRUN) $(ROOTDIR)/boot/ocamllex @@ -216,7 +218,7 @@ $(OCAMLDOC): $(EXECMOFILES) $(OCAMLC) -o $@ -linkall $(LINKFLAGS) $(OCAMLDOC_BCLIBRARIES) $^ $(OCAMLDOC_OPT): $(EXECMXFILES) - $(OCAMLOPT) -o $@ -linkall $(LINKFLAGS) $(OCAMLDOC_NCLIBRARIES) $^ + $(FLEXLINK_ENV)$(OCAMLOPT) -o $@ -linkall $(LINKFLAGS) $(OCAMLDOC_NCLIBRARIES) $^ $(OCAMLDOC_LIBCMA): $(LIBCMOFILES) $(OCAMLC) -a -o $@ $(LINKFLAGS) $^ @@ -268,7 +270,7 @@ odoc_see_lexer.ml: odoc_see_lexer.mll $(OCAMLOPT) $(OCAMLPP) $(COMPFLAGS) -c $< .ml.cmxs: - $(OCAMLOPT) -shared -o $@ $(OCAMLPP) $(COMPFLAGS) $< + $(FLEXLINK_ENV)$(OCAMLOPT) -shared -o $@ $(OCAMLPP) $(COMPFLAGS) $< .mll.ml: $(OCAMLLEX) $< diff --git a/ocamltest/Makefile b/ocamltest/Makefile index 527ee0c9d..c6863b1ee 100644 --- a/ocamltest/Makefile +++ b/ocamltest/Makefile @@ -22,15 +22,16 @@ ifeq "$(UNIX_OR_WIN32)" "win32" ocamlsrcdir := $(shell echo "$(abspath $(shell pwd)/..)"|cygpath -w -f - \ | sed 's/\\/\\\\\\\\/g') ifeq "$(wildcard ../flexdll/Makefile)" "" - FLEXLINK_ENV= + FLEXLINK_ENV = else - FLEXLINK_ENV=OCAML_FLEXLINK="../boot/ocamlrun ../flexdll/flexlink.exe" + # FLEXLINK_ENV must have a space at the end + FLEXLINK_ENV = OCAML_FLEXLINK="../boot/ocamlrun ../flexdll/flexlink.exe" # endif mkexe := $(MKEXE_ANSI) -link $(OC_LDFLAGS) else unix := true ocamlsrcdir := $(abspath $(shell pwd)/..) - FLEXLINK_ENV= + FLEXLINK_ENV = mkexe := $(MKEXE) endif @@ -158,9 +159,9 @@ flags := -g -nostdlib $(include_directories) \ -strict-sequence -safe-string -strict-formats \ -w +a-4-9-41-42-44-45-48 -warn-error A -ocamlc := $(FLEXLINK_ENV) ../runtime/ocamlrun ../ocamlc $(flags) +ocamlc := ../runtime/ocamlrun ../ocamlc $(flags) -ocamlopt := $(FLEXLINK_ENV) ../runtime/ocamlrun ../ocamlopt $(flags) +ocamlopt := ../runtime/ocamlrun ../ocamlopt $(flags) ocamldep := ../runtime/ocamlrun ../tools/ocamldep -slash @@ -178,13 +179,13 @@ allopt: ocamltest.opt$(EXE) opt.opt: allopt ocamltest$(EXE): $(bytecode_modules) - $(ocamlc) -custom ocamlcommon.cma -o $@ $^ + $(FLEXLINK_ENV)$(ocamlc) -custom ocamlcommon.cma -o $@ $^ %.cmo: %.ml $(ocamlc) -c $< ocamltest.opt$(EXE): $(native_modules) - $(ocamlopt) ocamlcommon.cmxa -o $@ $^ + $(FLEXLINK_ENV)$(ocamlopt) ocamlcommon.cmxa -o $@ $^ %.cmx: %.ml $(ocamlopt) -c $< diff --git a/otherlibs/Makefile b/otherlibs/Makefile index 22a4806c6..d3b8a4397 100644 --- a/otherlibs/Makefile +++ b/otherlibs/Makefile @@ -22,9 +22,11 @@ include $(ROOTDIR)/Makefile.common CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" -export OCAML_FLEXLINK:= +FLEXLINK_ENV = else -export OCAML_FLEXLINK:=$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe +# FLEXLINK_ENV must have a space at the end +FLEXLINK_ENV = \ + OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" # endif CAMLC=$(CAMLRUN) $(ROOTDIR)/ocamlc -nostdlib -I $(ROOTDIR)/stdlib @@ -74,10 +76,11 @@ $(LIBNAME).cmxa: $(CAMLOBJS_NAT) $(CAMLOBJS_NAT) $(LINKOPTS) $(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A) - $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa + $(FLEXLINK_ENV)$(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . \ + $(LIBNAME).cmxa lib$(CLIBNAME).$(A): $(COBJS) - $(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS) + $(FLEXLINK_ENV)$(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS) install:: if test -f dll$(CLIBNAME)$(EXT_DLL); then \ diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile index ae9a7a6ce..94fef78c0 100644 --- a/otherlibs/systhreads/Makefile +++ b/otherlibs/systhreads/Makefile @@ -21,9 +21,11 @@ include $(ROOTDIR)/Makefile.common CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" -export OCAML_FLEXLINK:= +FLEXLINK_ENV = else -export OCAML_FLEXLINK:=$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe +# FLEXLINK_ENV must have a space at the end +FLEXLINK_ENV = \ + OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" # endif LIBS = -nostdlib -I $(ROOTDIR)/stdlib -I $(ROOTDIR)/otherlibs/$(UNIXLIB) @@ -67,10 +69,10 @@ all: lib$(LIBNAME).$(A) $(LIBNAME).cma $(CMIFILES) allopt: lib$(LIBNAME)nat.$(A) $(LIBNAME).cmxa $(CMIFILES) lib$(LIBNAME).$(A): $(BYTECODE_C_OBJS) - $(MKLIB) -o $(LIBNAME) $(BYTECODE_C_OBJS) $(PTHREAD_LINK) + $(FLEXLINK_ENV)$(MKLIB) -o $(LIBNAME) $(BYTECODE_C_OBJS) $(PTHREAD_LINK) lib$(LIBNAME)nat.$(A): $(NATIVECODE_C_OBJS) - $(MKLIB) -o $(LIBNAME)nat $^ + $(FLEXLINK_ENV)$(MKLIB) -o $(LIBNAME)nat $^ $(LIBNAME).cma: $(THREADS_BCOBJS) ifeq "$(UNIX_OR_WIN32)" "unix" diff --git a/tools/Makefile b/tools/Makefile index 77f9c1192..bdc547308 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -50,7 +50,8 @@ $1: $3 $2 $$(CAMLC) $$(LINKFLAGS) -I .. -o $$@ $2 $1.opt: $3 $$(call byte2native,$2) - $$(CAMLOPT) $$(LINKFLAGS) -I .. -o $$@ $$(call byte2native,$2) + $$(FLEXLINK_ENV)$$(CAMLOPT) $$(LINKFLAGS) -I .. -o $$@ \ + $$(call byte2native,$2) all: $1 @@ -73,20 +74,16 @@ endef ROOTDIR=.. ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" -export OCAML_FLEXLINK:= +FLEXLINK_ENV = else -export OCAML_FLEXLINK:=$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe +# FLEXLINK_ENV must have a space at the end +FLEXLINK_ENV = \ + OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" # endif CAMLC=$(CAMLRUN) ../boot/ocamlc -g -nostdlib -I ../boot \ -use-prims ../runtime/primitives -I .. CAMLOPT=$(CAMLRUN) ../ocamlopt -g -nostdlib -I ../stdlib -ifeq "$(UNIX_OR_WIN32)" "win32" - ifneq "$(wildcard ../flexdll/Makefile)" "" - CAMLOPT := OCAML_FLEXLINK="../boot/ocamlrun ../flexdll/flexlink.exe" \ - $(CAMLOPT) - endif -endif CAMLLEX=$(CAMLRUN) ../boot/ocamllex INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \ -I ../middle_end -I ../middle_end/base_types -I ../driver \ @@ -366,7 +363,7 @@ LINTAPIDIFF=../compilerlibs/ocamlcommon.cmxa \ lintapidiff.opt: INCLUDES+= -I ../otherlibs/str lintapidiff.opt: $(LINTAPIDIFF) - $(CAMLOPT) $(LINKFLAGS) -I .. -o $@ $(LINTAPIDIFF) + $(FLEXLINK_ENV)$(CAMLOPT) $(LINKFLAGS) -I .. -o $@ $(LINTAPIDIFF) clean:: rm -f -- lintapidiff.opt lintapidiff.cm? lintapidiff.o