···28252825define INSTALL_ONE_NAT_TOOL
28262826install::
28272827ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
28282828- $(INSTALL_PROG) "tools/$(1)$(EXE)" "$(INSTALL_BINDIR)/$(1).byte$(EXE)";\
28292829- if test -f "tools/$(1)".opt$(EXE); then \
28302830- $(INSTALL_PROG) "tools/$(1).opt$(EXE)" "$(INSTALL_BINDIR)" && \
28312831- (cd "$(INSTALL_BINDIR)" && $(LN) "$(1).opt$(EXE)" "$(1)$(EXE)"); \
28322832- else \
28332833- (cd "$(INSTALL_BINDIR)" && $(LN) "$(1).byte$(EXE)" "$(1)$(EXE)"); \
28342834- fi
28352835-else
28362836- if test -f "tools/$(1)".opt$(EXE); then \
28372837- $(INSTALL_PROG) "tools/$(1).opt$(EXE)" "$(INSTALL_BINDIR)"; \
28382838- (cd "$(INSTALL_BINDIR)" && $(LN) "$(1).opt$(EXE)" "$(1)$(EXE)"); \
28392839- fi
28282828+ $(INSTALL_PROG) "tools/$(1)$(EXE)" "$(INSTALL_BINDIR)/$(1).byte$(EXE)"
28402829endif
28302830+ $(if $(wildcard tools/$(1).opt$(EXE)), \
28312831+ $(INSTALL_PROG) "tools/$(1).opt$(EXE)" "$(INSTALL_BINDIR)")
28322832+ (cd "$(INSTALL_BINDIR)" && \
28332833+ $(LN) "$(1).$(if $(wildcard tools/$(1).opt$(EXE)),opt,byte)$(EXE)" \
28342834+ "$(1)$(EXE)")
28412835endef
2842283628432837ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
···29382932ifeq "$(build_libraries_manpages)" "true"
29392933 $(MAKE) -C api_docgen install
29402934endif
29412941- if test -n "$(WITH_DEBUGGER)"; then \
29422942- $(INSTALL_PROG) debugger/ocamldebug$(EXE) "$(INSTALL_BINDIR)"; \
29432943- fi
29352935+ifneq "$(WITH_DEBUGGER)" ""
29362936+ $(INSTALL_PROG) debugger/ocamldebug$(EXE) "$(INSTALL_BINDIR)"
29372937+endif
29442938ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true"
29452939ifeq "$(TOOLCHAIN)" "msvc"
29462940 $(INSTALL_DATA) $(FLEXDLL_SOURCE_DIR)/$(FLEXDLL_MANIFEST) \
···29552949endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true"
29562950 $(INSTALL_DATA) Makefile.config "$(INSTALL_LIBDIR)"
29572951 $(INSTALL_DATA) $(DOC_FILES) "$(INSTALL_DOCDIR)"
29522952+ $(MAKE) install$(if $(wildcard ocamlopt$(EXE)),opt,-mklinks)
29532953+29542954+# Ensure the symlinks are created if the user configures for the native
29552955+# compiler but then doesn't build opt (legacy installation only)
29562956+.PHONY: install-mklinks
29572957+install-mklinks:
29582958ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
29592959- if test -f ocamlopt$(EXE); then $(MAKE) installopt; else \
29602960- cd "$(INSTALL_BINDIR)"; \
29612961- $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
29622962- $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
29632963- (test -f flexlink.byte$(EXE) && \
29642964- $(LN) flexlink.byte$(EXE) flexlink$(EXE)) || true; \
29652965- fi
29662966-else
29672967- if test -f ocamlopt$(EXE); then $(MAKE) installopt; fi
29592959+ cd "$(INSTALL_BINDIR)"; \
29602960+ $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
29612961+ $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
29622962+ (test -f flexlink.byte$(EXE) && \
29632963+ $(LN) flexlink.byte$(EXE) flexlink$(EXE)) || true
29682964endif
2969296529702966# Installation of the native-code compiler
···30233019 $(ocamlopt_CMO_FILES) \
30243020 "$(INSTALL_COMPLIBDIR)"
30253021ifeq "$(build_ocamldoc)" "true"
30263026- $(INSTALL_PROG) ocamldoc/ocamldoc.opt$(EXE) "$(INSTALL_BINDIR)"
30273027- $(INSTALL_DATA) \
30283028- ocamldoc/*.cmx ocamldoc/odoc_info.$(A) \
30293029- ocamldoc/odoc_info.cmxa \
30303030- "$(INSTALL_LIBDIR)/ocamldoc"
30223022+ $(if $(wildcard ocamldoc/ocamldoc.opt$(EXE)), \
30233023+ $(INSTALL_PROG) ocamldoc/ocamldoc.opt$(EXE) "$(INSTALL_BINDIR)")
30243024+ $(if $(wildcard ocamldoc/ocamldoc.opt$(EXE)), \
30253025+ $(INSTALL_DATA) \
30263026+ ocamldoc/*.cmx ocamldoc/odoc_info.$(A) \
30273027+ ocamldoc/odoc_info.cmxa \
30283028+ "$(INSTALL_LIBDIR)/ocamldoc")
30313029endif
30323030ifeq "$(strip $(NATDYNLINK))" "true"
30333031 $(INSTALL_DATA) \
···30383036 for i in $(OTHERLIBS); do \
30393037 $(MAKE) -C otherlibs/$$i installopt || exit $$?; \
30403038 done
30413041-ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
30423042- if test -f ocamlopt.opt$(EXE); then $(MAKE) installoptopt; else \
30433043- cd "$(INSTALL_BINDIR)"; \
30443044- $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
30453045- $(LN) ocamlopt.byte$(EXE) ocamlopt$(EXE); \
30463046- $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
30473047- (test -f flexlink.byte$(EXE) && \
30483048- $(LN) flexlink.byte$(EXE) flexlink$(EXE)) || true; \
30493049- fi
30503050-else
30513051- if test -f ocamlopt.opt$(EXE); then $(MAKE) installoptopt; fi
30523052-endif
30393039+ $(MAKE) installopt$(if $(wildcard ocamlopt.opt$(EXE)),opt,-mklinks)
30533040 $(INSTALL_DATA) \
30543041 tools/profiling.cmx tools/profiling.$(O) \
30553042 "$(INSTALL_LIBDIR_PROFILING)"
30433043+30443044+# Ensure the symlinks are created if the user configures for the native
30453045+# compiler but then doesn't build opt.opt (legacy installation only)
30463046+.PHONY: install-mklinks
30473047+installopt-mklinks:
30483048+ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
30493049+ cd "$(INSTALL_BINDIR)"; \
30503050+ $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
30513051+ $(LN) ocamlopt.byte$(EXE) ocamlopt$(EXE); \
30523052+ $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
30533053+ (test -f flexlink.byte$(EXE) && \
30543054+ $(LN) flexlink.byte$(EXE) flexlink$(EXE)) || true
30553055+endif
3056305630573057.PHONY: installoptopt
30583058installoptopt:
+2-3
api_docgen/ocamldoc/Makefile
···122122.PHONY: install
123123install:
124124 $(MKDIR) "$(INSTALL_LIBRARIES_MAN_DIR)"
125125- if test -d build/man; then \
126126- $(INSTALL_DATA) build/man/*.3o "$(INSTALL_LIBRARIES_MAN_DIR)"; \
127127- fi
125125+ $(if $(wildcard build/man), \
126126+ $(INSTALL_DATA) build/man/*.3o "$(INSTALL_LIBRARIES_MAN_DIR)")
+4-6
api_docgen/odoc/Makefile
···192192.PHONY: install
193193install:
194194 $(MKDIR) "$(INSTALL_LIBRARIES_MAN_DIR)"
195195- if test -d build/man/libref ; then \
196196- $(INSTALL_DATA) build/man/libref/* "$(INSTALL_LIBRARIES_MAN_DIR)"; \
197197- fi
198198- if test -d build/man/compilerlibref ; then \
199199- $(INSTALL_DATA) build/man/libref/* "$(INSTALL_LIBRARIES_MAN_DIR)"; \
200200- fi
195195+ $(if $(wildcard build/man/libref), \
196196+ $(INSTALL_DATA) build/man/libref/* "$(INSTALL_LIBRARIES_MAN_DIR)")
197197+ $(if $(wildcard build/man/compilerlibref), \
198198+ $(INSTALL_DATA) build/man/libref/* "$(INSTALL_LIBRARIES_MAN_DIR)")
201199202200# Dependencies for stdlib modules.
203201# Use the same dependencies used for compiling .cmx files.
+9-10
otherlibs/Makefile.otherlibs.common
···134134 $(CMIFILES:.cmi=.cmti) \
135135 "$(INSTALL_LIBDIR_LIBNAME)/"
136136endif
137137- if test -n "$(HEADERS)"; then \
138138- $(INSTALL_DATA) $(HEADERS) "$(INSTALL_INCDIR)/"; \
139139- fi
137137+ifneq "$(HEADERS)" ""
138138+ $(INSTALL_DATA) $(HEADERS) "$(INSTALL_INCDIR)/"
139139+endif
140140141141installopt:
142142 $(INSTALL_DATA) \
143143 $(CAMLOBJS_NAT) $(LIBNAME).cmxa $(LIBNAME).$(A) \
144144 "$(INSTALL_LIBDIR_LIBNAME)/"
145145- if test -f $(LIBNAME).cmxs; then \
146146- $(INSTALL_PROG) $(LIBNAME).cmxs "$(INSTALL_LIBDIR_LIBNAME)"; \
147147- fi
148148- if test -f dll$(CLIBNAME_NATIVE)$(EXT_DLL); then \
149149- $(INSTALL_PROG) \
150150- dll$(CLIBNAME_NATIVE)$(EXT_DLL) "$(INSTALL_STUBLIBDIR)"; \
151151- fi
145145+ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true"
146146+ $(INSTALL_PROG) $(LIBNAME).cmxs "$(INSTALL_LIBDIR_LIBNAME)"
147147+ifeq "$(SUFFIXING)" "false"
148148+ $(INSTALL_PROG) dll$(CLIBNAME_NATIVE)$(EXT_DLL) "$(INSTALL_STUBLIBDIR)"
149149+endif
150150+endif
152151ifneq "$(STUBSLIB_NATIVE)" ""
153152 $(INSTALL_DATA) $(STUBSLIB_NATIVE) "$(INSTALL_LIBDIR)/"
154153endif