2016-02-18 07:11:59 -08:00
|
|
|
#**************************************************************************
|
|
|
|
#* *
|
|
|
|
#* OCaml *
|
|
|
|
#* *
|
|
|
|
#* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
|
|
|
|
#* *
|
|
|
|
#* Copyright 1999 Institut National de Recherche en Informatique et *
|
|
|
|
#* en Automatique. *
|
|
|
|
#* *
|
|
|
|
#* All rights reserved. This file is distributed under the terms of *
|
|
|
|
#* the GNU Lesser General Public License version 2.1, with the *
|
|
|
|
#* special exception on linking described in the file LICENSE. *
|
|
|
|
#* *
|
|
|
|
#**************************************************************************
|
1999-11-17 10:59:06 -08:00
|
|
|
|
2001-03-26 03:08:00 -08:00
|
|
|
# The main Makefile
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2018-07-27 03:35:09 -07:00
|
|
|
ROOTDIR = .
|
2018-07-26 08:28:17 -07:00
|
|
|
|
2019-10-15 04:04:19 -07:00
|
|
|
# The configure and *clean targets can all be run without running ./configure
|
|
|
|
# first.
|
|
|
|
# If no goals were specified (i.e. `make`), add defaultentry (since it requires
|
|
|
|
# ./configure to be run)
|
|
|
|
CAN_BE_UNCONFIGURED := $(strip \
|
|
|
|
$(filter-out partialclean clean distclean configure, \
|
|
|
|
$(if $(MAKECMDGOALS),$(MAKECMDGOALS),defaultentry)))
|
|
|
|
|
|
|
|
ifeq "$(CAN_BE_UNCONFIGURED)" ""
|
2020-04-17 05:53:49 -07:00
|
|
|
-include Makefile.build_config
|
2019-10-15 04:04:19 -07:00
|
|
|
else
|
2020-04-17 05:53:49 -07:00
|
|
|
include Makefile.build_config
|
2019-10-15 04:04:19 -07:00
|
|
|
endif
|
2020-04-17 05:53:49 -07:00
|
|
|
include Makefile.common
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: defaultentry
|
2019-09-30 07:01:29 -07:00
|
|
|
ifeq "$(NATIVE_COMPILER)" "true"
|
|
|
|
defaultentry: world.opt
|
2017-02-06 07:46:39 -08:00
|
|
|
else
|
2019-09-30 07:01:29 -07:00
|
|
|
defaultentry: world
|
2017-02-06 07:46:39 -08:00
|
|
|
endif
|
|
|
|
|
|
|
|
MKDIR=mkdir -p
|
|
|
|
ifeq "$(UNIX_OR_WIN32)" "win32"
|
|
|
|
LN = cp
|
|
|
|
else
|
|
|
|
LN = ln -sf
|
|
|
|
endif
|
|
|
|
|
|
|
|
include stdlib/StdlibModules
|
|
|
|
|
2019-03-18 03:45:43 -07:00
|
|
|
CAMLC=$(BOOT_OCAMLC) -g -nostdlib -I boot -use-prims runtime/primitives
|
2017-02-06 07:46:39 -08:00
|
|
|
CAMLOPT=$(CAMLRUN) ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink
|
2020-04-24 07:04:50 -07:00
|
|
|
ARCHES=amd64 i386 arm arm64 power s390x riscv
|
2019-04-01 09:18:47 -07:00
|
|
|
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I file_formats \
|
|
|
|
-I lambda -I middle_end -I middle_end/closure \
|
|
|
|
-I middle_end/flambda -I middle_end/flambda/base_types \
|
|
|
|
-I asmcomp -I asmcomp/debug \
|
2017-09-15 03:08:14 -07:00
|
|
|
-I driver -I toplevel
|
2017-02-08 01:34:50 -08:00
|
|
|
|
2019-04-15 05:29:56 -07:00
|
|
|
COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \
|
2017-02-06 07:46:39 -08:00
|
|
|
-warn-error A \
|
|
|
|
-bin-annot -safe-string -strict-formats $(INCLUDES)
|
|
|
|
LINKFLAGS=
|
|
|
|
|
|
|
|
ifeq "$(strip $(NATDYNLINKOPTS))" ""
|
|
|
|
OCAML_NATDYNLINKOPTS=
|
|
|
|
else
|
|
|
|
OCAML_NATDYNLINKOPTS = -ccopt "$(NATDYNLINKOPTS)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
YACCFLAGS=-v --strict
|
|
|
|
CAMLLEX=$(CAMLRUN) boot/ocamllex
|
2018-02-21 08:46:15 -08:00
|
|
|
CAMLDEP=$(CAMLRUN) boot/ocamlc -depend
|
2018-12-08 07:19:06 -08:00
|
|
|
DEPFLAGS=-slash
|
|
|
|
DEPINCLUDES=$(INCLUDES)
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
OCAMLDOC_OPT=$(WITH_OCAMLDOC:=.opt)
|
2020-01-16 08:50:27 -08:00
|
|
|
OCAMLTEST_OPT=$(WITH_OCAMLTEST:=.opt)
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
BYTESTART=driver/main.cmo
|
|
|
|
|
|
|
|
OPTSTART=driver/optmain.cmo
|
|
|
|
|
|
|
|
TOPLEVELSTART=toplevel/topstart.cmo
|
|
|
|
|
|
|
|
OPTTOPLEVELSTART=toplevel/opttopstart.cmo
|
|
|
|
|
|
|
|
PERVASIVES=$(STDLIB_MODULES) outcometree topdirs toploop
|
|
|
|
|
|
|
|
LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader
|
|
|
|
|
|
|
|
COMPLIBDIR=$(LIBDIR)/compiler-libs
|
|
|
|
|
2018-02-25 03:24:38 -08:00
|
|
|
TOPINCLUDES=$(addprefix -I otherlibs/,$(filter-out %threads,$(OTHERLIBRARIES)))
|
2018-06-20 08:43:29 -07:00
|
|
|
RUNTOP=./runtime/ocamlrun ./ocaml \
|
2017-02-06 07:46:39 -08:00
|
|
|
-nostdlib -I stdlib \
|
2018-02-25 01:59:47 -08:00
|
|
|
-noinit $(TOPFLAGS) $(TOPINCLUDES)
|
|
|
|
NATRUNTOP=./ocamlnat$(EXE) \
|
|
|
|
-nostdlib -I stdlib \
|
|
|
|
-noinit $(TOPFLAGS) $(TOPINCLUDES)
|
2017-10-19 08:15:52 -07:00
|
|
|
ifeq "$(UNIX_OR_WIN32)" "unix"
|
2017-02-06 07:46:39 -08:00
|
|
|
EXTRAPATH=
|
|
|
|
else
|
|
|
|
EXTRAPATH = PATH="otherlibs/win32unix:$(PATH)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
BOOT_FLEXLINK_CMD=
|
|
|
|
|
|
|
|
ifeq "$(UNIX_OR_WIN32)" "win32"
|
|
|
|
FLEXDLL_SUBMODULE_PRESENT := $(wildcard flexdll/Makefile)
|
|
|
|
ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" ""
|
2018-07-26 07:16:11 -07:00
|
|
|
BOOT_FLEXLINK_CMD =
|
2017-02-06 07:46:39 -08:00
|
|
|
else
|
|
|
|
BOOT_FLEXLINK_CMD = FLEXLINK_CMD="../boot/ocamlrun ../flexdll/flexlink.exe"
|
|
|
|
endif
|
2017-01-27 07:08:41 -08:00
|
|
|
else
|
2017-02-06 07:46:39 -08:00
|
|
|
endif
|
|
|
|
|
2019-12-26 00:37:26 -08:00
|
|
|
# targets for the compilerlibs/*.{cma,cmxa} archives
|
|
|
|
include compilerlibs/Makefile.compilerlibs
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
# The configuration file
|
|
|
|
|
2019-06-16 05:44:02 -07:00
|
|
|
utils/config.ml: utils/config.mlp Makefile.config utils/Makefile
|
2018-10-10 08:16:00 -07:00
|
|
|
$(MAKE) -C utils config.ml
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: reconfigure
|
|
|
|
reconfigure:
|
2019-09-29 04:11:57 -07:00
|
|
|
ac_read_git_config=true ./configure $(CONFIGURE_ARGS)
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-06-03 04:56:45 -07:00
|
|
|
utils/domainstate.ml: utils/domainstate.ml.c runtime/caml/domain_state.tbl
|
|
|
|
$(CPP) -I runtime/caml $< > $@
|
|
|
|
|
2019-06-25 23:21:23 -07:00
|
|
|
utils/domainstate.mli: utils/domainstate.mli.c runtime/caml/domain_state.tbl
|
2019-06-03 04:56:45 -07:00
|
|
|
$(CPP) -I runtime/caml $< > $@
|
|
|
|
|
2018-12-04 02:29:02 -08:00
|
|
|
configure: configure.ac aclocal.m4 VERSION tools/autogen
|
|
|
|
tools/autogen
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
.PHONY: partialclean
|
|
|
|
partialclean::
|
2019-06-03 04:56:45 -07:00
|
|
|
rm -f utils/config.ml utils/domainstate.ml utils/domainstate.mli
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: beforedepend
|
2019-06-03 04:56:45 -07:00
|
|
|
beforedepend:: utils/config.ml utils/domainstate.ml utils/domainstate.mli
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Start up the system from the distribution compiler
|
|
|
|
.PHONY: coldstart
|
|
|
|
coldstart:
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all
|
|
|
|
cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE)
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C stdlib $(BOOT_FLEXLINK_CMD) \
|
2019-03-18 03:45:43 -07:00
|
|
|
CAMLC='$$(BOOT_OCAMLC) -use-prims ../runtime/primitives' all
|
2017-02-06 07:46:39 -08:00
|
|
|
cd stdlib; cp $(LIBFILES) ../boot
|
2018-06-20 08:43:29 -07:00
|
|
|
cd boot; $(LN) ../runtime/libcamlrun.$(A) .
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Recompile the core system using the bootstrap compiler
|
|
|
|
.PHONY: coreall
|
2018-05-29 07:21:46 -07:00
|
|
|
coreall: runtime
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) ocamlc
|
2018-08-25 10:50:16 -07:00
|
|
|
$(MAKE) ocamllex ocamltools library
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Build the core system: the minimum needed to make depend and bootstrap
|
|
|
|
.PHONY: core
|
|
|
|
core:
|
|
|
|
$(MAKE) coldstart
|
|
|
|
$(MAKE) coreall
|
|
|
|
|
|
|
|
# Check if fixpoint reached
|
|
|
|
.PHONY: compare
|
|
|
|
compare:
|
|
|
|
@if $(CAMLRUN) tools/cmpbyt boot/ocamlc ocamlc \
|
2017-12-18 06:07:08 -08:00
|
|
|
&& $(CAMLRUN) tools/cmpbyt boot/ocamllex lex/ocamllex; \
|
2017-02-06 07:46:39 -08:00
|
|
|
then echo "Fixpoint reached, bootstrap succeeded."; \
|
2018-05-29 07:21:46 -07:00
|
|
|
else \
|
|
|
|
echo "Fixpoint not reached, try one more bootstrapping cycle."; \
|
|
|
|
exit 1; \
|
2017-02-06 07:46:39 -08:00
|
|
|
fi
|
|
|
|
|
2018-05-16 07:05:36 -07:00
|
|
|
# Promote a compiler
|
|
|
|
|
|
|
|
PROMOTE ?= cp
|
|
|
|
|
|
|
|
.PHONY: promote-common
|
|
|
|
promote-common:
|
|
|
|
$(PROMOTE) ocamlc boot/ocamlc
|
|
|
|
$(PROMOTE) lex/ocamllex boot/ocamllex
|
|
|
|
cd stdlib; cp $(LIBFILES) ../boot
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
# Promote the newly compiled system to the rank of cross compiler
|
|
|
|
# (Runs on the old runtime, produces code for the new runtime)
|
|
|
|
.PHONY: promote-cross
|
2018-05-16 07:05:36 -07:00
|
|
|
promote-cross: promote-common
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Promote the newly compiled system to the rank of bootstrap compiler
|
|
|
|
# (Runs on the new runtime, produces code for the new runtime)
|
|
|
|
.PHONY: promote
|
2018-05-16 07:05:36 -07:00
|
|
|
promote: PROMOTE = $(CAMLRUN) tools/stripdebug
|
|
|
|
promote: promote-common
|
2018-06-20 08:43:29 -07:00
|
|
|
cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE)
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Compile the native-code compiler
|
|
|
|
.PHONY: opt-core
|
2017-02-08 02:17:11 -08:00
|
|
|
opt-core: runtimeopt
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) ocamlopt
|
|
|
|
$(MAKE) libraryopt
|
|
|
|
|
|
|
|
.PHONY: opt
|
2019-04-28 01:00:57 -07:00
|
|
|
opt: checknative
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) runtimeopt
|
|
|
|
$(MAKE) ocamlopt
|
|
|
|
$(MAKE) libraryopt
|
|
|
|
$(MAKE) otherlibrariesopt ocamltoolsopt
|
|
|
|
|
|
|
|
# Native-code versions of the tools
|
|
|
|
.PHONY: opt.opt
|
2019-04-28 01:00:57 -07:00
|
|
|
opt.opt: checknative
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) checkstack
|
|
|
|
$(MAKE) runtime
|
|
|
|
$(MAKE) core
|
|
|
|
$(MAKE) ocaml
|
|
|
|
$(MAKE) opt-core
|
|
|
|
$(MAKE) ocamlc.opt
|
2020-01-16 08:50:27 -08:00
|
|
|
$(MAKE) otherlibraries $(WITH_DEBUGGER) $(WITH_OCAMLDOC) \
|
|
|
|
$(WITH_OCAMLTEST)
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) ocamlopt.opt
|
|
|
|
$(MAKE) otherlibrariesopt
|
2017-07-24 02:04:09 -07:00
|
|
|
$(MAKE) ocamllex.opt ocamltoolsopt ocamltoolsopt.opt $(OCAMLDOC_OPT) \
|
2020-01-16 08:50:27 -08:00
|
|
|
$(OCAMLTEST_OPT)
|
2020-02-26 07:07:17 -08:00
|
|
|
ifeq "$(WITH_OCAMLDOC)-$(STDLIB_MANPAGES)" "ocamldoc-true"
|
2019-07-27 12:22:57 -07:00
|
|
|
$(MAKE) manpages
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Core bootstrapping cycle
|
2017-02-15 01:32:58 -08:00
|
|
|
.PHONY: coreboot
|
2017-02-06 07:46:39 -08:00
|
|
|
coreboot:
|
|
|
|
# Promote the new compiler but keep the old runtime
|
|
|
|
# This compiler runs on boot/ocamlrun and produces bytecode for
|
2018-06-20 08:43:29 -07:00
|
|
|
# runtime/ocamlrun
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) promote-cross
|
2018-06-20 08:43:29 -07:00
|
|
|
# Rebuild ocamlc and ocamllex (run on runtime/ocamlrun)
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) partialclean
|
|
|
|
$(MAKE) ocamlc ocamllex ocamltools
|
2018-06-20 08:43:29 -07:00
|
|
|
# Rebuild the library (using runtime/ocamlrun ./ocamlc)
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) library-cross
|
|
|
|
# Promote the new compiler and the new runtime
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) CAMLRUN=runtime/ocamlrun promote
|
2017-02-06 07:46:39 -08:00
|
|
|
# Rebuild the core system
|
|
|
|
$(MAKE) partialclean
|
|
|
|
$(MAKE) core
|
|
|
|
# Check if fixpoint reached
|
|
|
|
$(MAKE) compare
|
|
|
|
|
|
|
|
# Recompile the system using the bootstrap compiler
|
|
|
|
|
|
|
|
.PHONY: all
|
2018-05-29 07:21:46 -07:00
|
|
|
all: coreall
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) ocaml
|
2020-01-16 08:50:27 -08:00
|
|
|
$(MAKE) otherlibraries $(WITH_DEBUGGER) $(WITH_OCAMLDOC) \
|
|
|
|
$(WITH_OCAMLTEST)
|
2020-02-26 07:07:17 -08:00
|
|
|
ifeq "$(WITH_OCAMLDOC)-$(STDLIB_MANPAGES)" "ocamldoc-true"
|
2019-07-27 12:22:57 -07:00
|
|
|
$(MAKE) manpages
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Bootstrap and rebuild the whole system.
|
|
|
|
# The compilation of ocaml will fail if the runtime has changed.
|
|
|
|
# Never mind, just do make bootstrap to reach fixpoint again.
|
|
|
|
.PHONY: bootstrap
|
|
|
|
bootstrap: coreboot
|
|
|
|
$(MAKE) all
|
|
|
|
|
|
|
|
# Compile everything the first time
|
|
|
|
|
|
|
|
.PHONY: world
|
|
|
|
world: coldstart
|
|
|
|
$(MAKE) all
|
|
|
|
|
|
|
|
# Compile also native code compiler and libraries, fast
|
|
|
|
.PHONY: world.opt
|
2019-04-28 01:00:57 -07:00
|
|
|
world.opt: checknative
|
|
|
|
$(MAKE) coldstart
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) opt.opt
|
|
|
|
|
|
|
|
# FlexDLL sources missing error messages
|
|
|
|
# Different git mechanism displayed depending on whether this source tree came
|
|
|
|
# from a git clone or a source tarball.
|
|
|
|
|
|
|
|
flexdll/Makefile:
|
|
|
|
@echo In order to bootstrap FlexDLL, you need to place the sources in
|
|
|
|
@echo flexdll.
|
|
|
|
@echo This can either be done by downloading a source tarball from
|
|
|
|
@echo \ http://alain.frisch.fr/flexdll.html
|
|
|
|
@if [ -d .git ]; then \
|
|
|
|
echo or by checking out the flexdll submodule with; \
|
|
|
|
echo \ git submodule update --init; \
|
|
|
|
else \
|
|
|
|
echo or by cloning the git repository; \
|
|
|
|
echo \ git clone https://github.com/alainfrisch/flexdll.git; \
|
|
|
|
fi
|
|
|
|
@false
|
|
|
|
|
|
|
|
.PHONY: flexdll
|
2017-01-27 10:23:57 -08:00
|
|
|
flexdll: flexdll/Makefile flexlink
|
2017-03-19 05:47:07 -07:00
|
|
|
$(MAKE) -C flexdll \
|
2018-09-12 07:32:44 -07:00
|
|
|
OCAML_CONFIG_FILE=../Makefile.config \
|
2017-03-19 05:47:07 -07:00
|
|
|
MSVC_DETECT=0 CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false support
|
2017-01-27 10:23:57 -08:00
|
|
|
|
|
|
|
# Bootstrapping flexlink - leaves a bytecode image of flexlink.exe in flexdll/
|
|
|
|
.PHONY: flexlink
|
|
|
|
flexlink: flexdll/Makefile
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime BOOTSTRAPPING_FLEXLINK=yes ocamlrun$(EXE)
|
|
|
|
cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE)
|
2019-03-26 04:32:47 -07:00
|
|
|
$(MAKE) -C stdlib COMPILER=../boot/ocamlc \
|
|
|
|
$(filter-out *.cmi,$(LIBFILES))
|
|
|
|
cd stdlib && cp $(LIBFILES) ../boot/
|
2018-09-12 07:32:44 -07:00
|
|
|
$(MAKE) -C flexdll MSVC_DETECT=0 OCAML_CONFIG_FILE=../Makefile.config \
|
2017-10-05 07:48:08 -07:00
|
|
|
CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false \
|
2019-03-26 04:17:43 -07:00
|
|
|
OCAMLOPT="../boot/ocamlrun ../boot/ocamlc -nostdlib -I ../boot" \
|
2017-01-27 10:23:57 -08:00
|
|
|
flexlink.exe
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime clean
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) partialclean
|
|
|
|
|
|
|
|
.PHONY: flexlink.opt
|
|
|
|
flexlink.opt:
|
|
|
|
cd flexdll && \
|
|
|
|
mv flexlink.exe flexlink && \
|
2018-07-26 07:23:42 -07:00
|
|
|
($(MAKE) OCAML_FLEXLINK="../boot/ocamlrun ./flexlink" MSVC_DETECT=0 \
|
2018-09-12 07:32:44 -07:00
|
|
|
OCAML_CONFIG_FILE=../Makefile.config \
|
2019-03-26 04:17:43 -07:00
|
|
|
OCAMLOPT="../ocamlopt.opt -nostdlib -I ../stdlib" \
|
|
|
|
flexlink.exe || \
|
2018-07-26 07:23:42 -07:00
|
|
|
(mv flexlink flexlink.exe && false)) && \
|
2017-02-06 07:46:39 -08:00
|
|
|
mv flexlink.exe flexlink.opt && \
|
|
|
|
mv flexlink flexlink.exe
|
|
|
|
|
2018-03-29 05:38:33 -07:00
|
|
|
INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR)
|
|
|
|
INSTALL_FLEXDLLDIR=$(INSTALL_LIBDIR)/flexdll
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
.PHONY: install-flexdll
|
|
|
|
install-flexdll:
|
2019-03-26 04:32:47 -07:00
|
|
|
$(INSTALL_PROG) flexdll/flexlink.exe "$(INSTALL_BINDIR)/flexlink$(EXE)"
|
2017-03-09 05:58:40 -08:00
|
|
|
ifneq "$(filter-out mingw,$(TOOLCHAIN))" ""
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) flexdll/default$(filter-out _i386,_$(ARCH)).manifest \
|
2017-03-19 05:47:07 -07:00
|
|
|
"$(INSTALL_BINDIR)/"
|
2017-03-09 05:58:40 -08:00
|
|
|
endif
|
2017-01-27 10:23:57 -08:00
|
|
|
if test -n "$(wildcard flexdll/flexdll_*.$(O))" ; then \
|
2018-03-29 05:15:23 -07:00
|
|
|
$(MKDIR) "$(INSTALL_FLEXDLLDIR)" ; \
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) flexdll/flexdll_*.$(O) "$(INSTALL_FLEXDLLDIR)" ; \
|
2017-01-27 10:23:57 -08:00
|
|
|
fi
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Installation
|
|
|
|
.PHONY: install
|
|
|
|
install:
|
|
|
|
$(MKDIR) "$(INSTALL_BINDIR)"
|
|
|
|
$(MKDIR) "$(INSTALL_LIBDIR)"
|
|
|
|
$(MKDIR) "$(INSTALL_STUBLIBDIR)"
|
|
|
|
$(MKDIR) "$(INSTALL_COMPLIBDIR)"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
VERSION \
|
|
|
|
"$(INSTALL_LIBDIR)"
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime install
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) ocaml "$(INSTALL_BINDIR)/ocaml$(EXE)"
|
2018-05-14 01:44:01 -07:00
|
|
|
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) ocamlc "$(INSTALL_BINDIR)/ocamlc.byte$(EXE)"
|
2018-05-14 01:44:01 -07:00
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C stdlib install
|
2018-05-14 01:44:01 -07:00
|
|
|
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) lex/ocamllex "$(INSTALL_BINDIR)/ocamllex.byte$(EXE)"
|
2018-05-14 01:44:01 -07:00
|
|
|
endif
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) yacc/ocamlyacc$(EXE) "$(INSTALL_BINDIR)/ocamlyacc$(EXE)"
|
|
|
|
$(INSTALL_DATA) \
|
2018-05-14 00:15:44 -07:00
|
|
|
utils/*.cmi \
|
|
|
|
parsing/*.cmi \
|
|
|
|
typing/*.cmi \
|
|
|
|
bytecomp/*.cmi \
|
2019-04-01 09:18:47 -07:00
|
|
|
file_formats/*.cmi \
|
|
|
|
lambda/*.cmi \
|
2018-05-14 00:15:44 -07:00
|
|
|
driver/*.cmi \
|
|
|
|
toplevel/*.cmi \
|
2017-02-06 07:46:39 -08:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-05-14 00:15:44 -07:00
|
|
|
ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
utils/*.cmt utils/*.cmti utils/*.mli \
|
|
|
|
parsing/*.cmt parsing/*.cmti parsing/*.mli \
|
|
|
|
typing/*.cmt typing/*.cmti typing/*.mli \
|
2019-04-01 09:18:47 -07:00
|
|
|
file_formats/*.cmt file_formats/*.cmti file_formats/*.mli \
|
|
|
|
lambda/*.cmt lambda/*.cmti lambda/*.mli \
|
2018-05-14 00:15:44 -07:00
|
|
|
bytecomp/*.cmt bytecomp/*.cmti bytecomp/*.mli \
|
|
|
|
driver/*.cmt driver/*.cmti driver/*.mli \
|
|
|
|
toplevel/*.cmt toplevel/*.cmti toplevel/*.mli \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
endif
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
2019-10-29 04:44:12 -07:00
|
|
|
compilerlibs/*.cma \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
$(BYTESTART) $(TOPLEVELSTART) \
|
2017-02-06 07:46:39 -08:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) expunge "$(INSTALL_LIBDIR)/expunge$(EXE)"
|
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
toplevel/topdirs.cmi \
|
2018-05-14 00:15:44 -07:00
|
|
|
"$(INSTALL_LIBDIR)"
|
|
|
|
ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
|
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
toplevel/topdirs.cmt toplevel/topdirs.cmti \
|
|
|
|
toplevel/topdirs.mli \
|
|
|
|
"$(INSTALL_LIBDIR)"
|
2018-05-14 00:15:44 -07:00
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C tools install
|
|
|
|
ifeq "$(UNIX_OR_WIN32)" "unix" # Install manual pages only on Unix
|
2017-03-26 22:38:40 -07:00
|
|
|
$(MKDIR) "$(INSTALL_MANDIR)/man$(PROGRAMS_MAN_SECTION)"
|
2017-02-06 07:46:39 -08:00
|
|
|
-$(MAKE) -C man install
|
|
|
|
endif
|
|
|
|
for i in $(OTHERLIBRARIES); do \
|
|
|
|
$(MAKE) -C otherlibs/$$i install || exit $$?; \
|
|
|
|
done
|
2017-08-19 08:44:26 -07:00
|
|
|
# Transitional: findlib 1.7.3 is confused if leftover num.cm? files remain
|
|
|
|
# from an previous installation of OCaml before otherlibs/num was removed.
|
|
|
|
rm -f "$(INSTALL_LIBDIR)"/num.cm?
|
|
|
|
# End transitional
|
2019-07-27 12:22:57 -07:00
|
|
|
ifneq "$(WITH_OCAMLDOC)" ""
|
|
|
|
$(MAKE) -C ocamldoc install
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
if test -n "$(WITH_DEBUGGER)"; then \
|
|
|
|
$(MAKE) -C debugger install; \
|
|
|
|
fi
|
|
|
|
ifeq "$(UNIX_OR_WIN32)" "win32"
|
|
|
|
if test -n "$(FLEXDLL_SUBMODULE_PRESENT)"; then \
|
|
|
|
$(MAKE) install-flexdll; \
|
|
|
|
fi
|
|
|
|
endif
|
2018-09-12 07:32:44 -07:00
|
|
|
$(INSTALL_DATA) Makefile.config "$(INSTALL_LIBDIR)/Makefile.config"
|
2018-05-14 01:44:01 -07:00
|
|
|
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
|
2017-02-06 07:46:39 -08:00
|
|
|
if test -f ocamlopt; then $(MAKE) installopt; else \
|
|
|
|
cd "$(INSTALL_BINDIR)"; \
|
|
|
|
$(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
|
|
|
|
$(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
|
|
|
|
fi
|
2018-05-14 01:44:01 -07:00
|
|
|
else
|
|
|
|
if test -f ocamlopt; then $(MAKE) installopt; fi
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Installation of the native-code compiler
|
|
|
|
.PHONY: installopt
|
|
|
|
installopt:
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime installopt
|
2018-05-14 01:44:01 -07:00
|
|
|
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) ocamlopt "$(INSTALL_BINDIR)/ocamlopt.byte$(EXE)"
|
2018-05-14 01:44:01 -07:00
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C stdlib installopt
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
middle_end/*.cmi \
|
2018-05-14 00:15:44 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
2019-04-01 09:18:47 -07:00
|
|
|
middle_end/closure/*.cmi \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
middle_end/flambda/*.cmi \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
middle_end/flambda/base_types/*.cmi \
|
2018-05-14 00:15:44 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
asmcomp/*.cmi \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2019-09-06 07:46:50 -07:00
|
|
|
$(INSTALL_DATA) \
|
|
|
|
asmcomp/debug/*.cmi \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-05-14 00:15:44 -07:00
|
|
|
ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
|
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
middle_end/*.cmt middle_end/*.cmti \
|
2017-02-06 07:46:39 -08:00
|
|
|
middle_end/*.mli \
|
2017-10-18 02:57:19 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
2019-04-01 09:18:47 -07:00
|
|
|
middle_end/closure/*.cmt middle_end/closure/*.cmti \
|
|
|
|
middle_end/closure/*.mli \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
middle_end/flambda/*.cmt middle_end/flambda/*.cmti \
|
|
|
|
middle_end/flambda/*.mli \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
|
|
|
middle_end/flambda/base_types/*.cmt \
|
|
|
|
middle_end/flambda/base_types/*.cmti \
|
|
|
|
middle_end/flambda/base_types/*.mli \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
asmcomp/*.cmt asmcomp/*.cmti \
|
|
|
|
asmcomp/*.mli \
|
2017-10-18 02:57:19 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2019-09-06 07:46:50 -07:00
|
|
|
$(INSTALL_DATA) \
|
|
|
|
asmcomp/debug/*.cmt asmcomp/debug/*.cmti \
|
|
|
|
asmcomp/debug/*.mli \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-05-14 00:15:44 -07:00
|
|
|
endif
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
2019-10-29 04:44:12 -07:00
|
|
|
$(OPTSTART) \
|
2017-10-18 02:57:19 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2019-07-27 12:22:57 -07:00
|
|
|
ifneq "$(WITH_OCAMLDOC)" ""
|
|
|
|
$(MAKE) -C ocamldoc installopt
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
for i in $(OTHERLIBRARIES); do \
|
|
|
|
$(MAKE) -C otherlibs/$$i installopt || exit $$?; \
|
|
|
|
done
|
2018-05-14 01:44:01 -07:00
|
|
|
ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true"
|
2017-02-06 07:46:39 -08:00
|
|
|
if test -f ocamlopt.opt ; then $(MAKE) installoptopt; else \
|
|
|
|
cd "$(INSTALL_BINDIR)"; \
|
|
|
|
$(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \
|
|
|
|
$(LN) ocamlopt.byte$(EXE) ocamlopt$(EXE); \
|
|
|
|
$(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \
|
|
|
|
fi
|
2018-05-14 01:44:01 -07:00
|
|
|
else
|
|
|
|
if test -f ocamlopt.opt ; then $(MAKE) installoptopt; fi
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C tools installopt
|
|
|
|
if test -f ocamlopt.opt -a -f flexdll/flexlink.opt ; then \
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
flexdll/flexlink.opt "$(INSTALL_BINDIR)/flexlink$(EXE)" ; \
|
2017-02-06 07:46:39 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
.PHONY: installoptopt
|
|
|
|
installoptopt:
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) ocamlc.opt "$(INSTALL_BINDIR)/ocamlc.opt$(EXE)"
|
|
|
|
$(INSTALL_PROG) ocamlopt.opt "$(INSTALL_BINDIR)/ocamlopt.opt$(EXE)"
|
|
|
|
$(INSTALL_PROG) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
lex/ocamllex.opt "$(INSTALL_BINDIR)/ocamllex.opt$(EXE)"
|
2017-02-06 07:46:39 -08:00
|
|
|
cd "$(INSTALL_BINDIR)"; \
|
|
|
|
$(LN) ocamlc.opt$(EXE) ocamlc$(EXE); \
|
|
|
|
$(LN) ocamlopt.opt$(EXE) ocamlopt$(EXE); \
|
|
|
|
$(LN) ocamllex.opt$(EXE) ocamllex$(EXE)
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
utils/*.cmx parsing/*.cmx typing/*.cmx bytecomp/*.cmx \
|
2019-04-01 09:18:47 -07:00
|
|
|
file_formats/*.cmx \
|
|
|
|
lambda/*.cmx \
|
2018-01-15 13:57:37 -08:00
|
|
|
driver/*.cmx asmcomp/*.cmx middle_end/*.cmx \
|
2019-04-01 09:18:47 -07:00
|
|
|
middle_end/closure/*.cmx \
|
|
|
|
middle_end/flambda/*.cmx \
|
|
|
|
middle_end/flambda/base_types/*.cmx \
|
2019-09-06 07:46:50 -07:00
|
|
|
asmcomp/debug/*.cmx \
|
2019-04-01 09:18:47 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
2019-10-29 04:44:12 -07:00
|
|
|
compilerlibs/*.cmxa compilerlibs/*.$(A) \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
$(INSTALL_DATA) \
|
2017-02-06 07:46:39 -08:00
|
|
|
$(BYTESTART:.cmo=.cmx) $(BYTESTART:.cmo=.$(O)) \
|
|
|
|
$(OPTSTART:.cmo=.cmx) $(OPTSTART:.cmo=.$(O)) \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
|
|
|
if test -f ocamlnat$(EXE) ; then \
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_PROG) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
ocamlnat$(EXE) "$(INSTALL_BINDIR)/ocamlnat$(EXE)"; \
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
toplevel/opttopdirs.cmi \
|
|
|
|
"$(INSTALL_LIBDIR)"; \
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
2017-02-06 07:46:39 -08:00
|
|
|
$(OPTTOPLEVELSTART:.cmo=.cmx) $(OPTTOPLEVELSTART:.cmo=.$(O)) \
|
|
|
|
"$(INSTALL_COMPLIBDIR)"; \
|
|
|
|
fi
|
|
|
|
cd "$(INSTALL_COMPLIBDIR)" && \
|
|
|
|
$(RANLIB) ocamlcommon.$(A) ocamlbytecomp.$(A) ocamloptcomp.$(A)
|
|
|
|
|
|
|
|
# Installation of the *.ml sources of compiler-libs
|
|
|
|
.PHONY: install-compiler-sources
|
|
|
|
install-compiler-sources:
|
2018-05-14 00:15:44 -07:00
|
|
|
ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
|
2018-03-29 05:24:51 -07:00
|
|
|
$(INSTALL_DATA) \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
utils/*.ml parsing/*.ml typing/*.ml bytecomp/*.ml driver/*.ml \
|
2019-04-01 09:18:47 -07:00
|
|
|
file_formats/*.ml \
|
|
|
|
lambda/*.ml \
|
|
|
|
toplevel/*.ml middle_end/*.ml middle_end/closure/*.ml \
|
|
|
|
middle_end/flambda/*.ml middle_end/flambda/base_types/*.ml \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
asmcomp/*.ml \
|
2019-09-06 07:46:50 -07:00
|
|
|
asmcmp/debug/*.ml \
|
makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.
¹: a brtfs filesystem on an old-ish SSD
Why I care
----------
An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.
Partial diagnosis
-----------------
The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.
Change
------
The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).
Testing
-------
I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.
Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:
for f in $(find $DESTDIR); do \
echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
done | sort
Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-28 08:46:34 -07:00
|
|
|
"$(INSTALL_COMPLIBDIR)"
|
2018-05-14 00:15:44 -07:00
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Run all tests
|
|
|
|
|
|
|
|
.PHONY: tests
|
2018-05-29 07:39:55 -07:00
|
|
|
tests:
|
|
|
|
$(MAKE) -C testsuite all
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Make clean in the test suite
|
|
|
|
|
2017-02-08 04:31:20 -08:00
|
|
|
.PHONY: clean
|
2017-02-06 07:46:39 -08:00
|
|
|
clean::
|
|
|
|
$(MAKE) -C testsuite clean
|
|
|
|
|
|
|
|
# Build the manual latex files from the etex source files
|
|
|
|
# (see manual/README.md)
|
|
|
|
.PHONY: manual-pregen
|
|
|
|
manual-pregen: opt.opt
|
|
|
|
cd manual; $(MAKE) clean && $(MAKE) pregen-etex
|
|
|
|
|
|
|
|
# The clean target
|
|
|
|
clean:: partialclean
|
|
|
|
|
|
|
|
# The bytecode compiler
|
|
|
|
|
|
|
|
ocamlc: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -compat-32 -o $@ $^
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -rf ocamlc
|
|
|
|
|
|
|
|
# The native-code compiler
|
|
|
|
|
|
|
|
ocamlopt: compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma \
|
2017-08-16 06:33:21 -07:00
|
|
|
$(OPTSTART)
|
2017-02-06 07:46:39 -08:00
|
|
|
$(CAMLC) $(LINKFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f ocamlopt
|
|
|
|
|
|
|
|
# The toplevel
|
|
|
|
|
|
|
|
ocaml_dependencies := \
|
|
|
|
compilerlibs/ocamlcommon.cma \
|
|
|
|
compilerlibs/ocamlbytecomp.cma \
|
|
|
|
compilerlibs/ocamltoplevel.cma $(TOPLEVELSTART)
|
|
|
|
|
|
|
|
.INTERMEDIATE: ocaml.tmp
|
|
|
|
ocaml.tmp: $(ocaml_dependencies)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -linkall -o $@ $^
|
|
|
|
|
|
|
|
ocaml: expunge ocaml.tmp
|
|
|
|
- $(CAMLRUN) $^ $@ $(PERVASIVES)
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f ocaml
|
|
|
|
|
|
|
|
.PHONY: runtop
|
|
|
|
runtop:
|
2017-10-19 08:15:52 -07:00
|
|
|
$(MAKE) coldstart
|
|
|
|
$(MAKE) ocamlc
|
|
|
|
$(MAKE) otherlibraries
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) ocaml
|
|
|
|
@rlwrap --help 2>/dev/null && $(EXTRAPATH) rlwrap $(RUNTOP) ||\
|
|
|
|
$(EXTRAPATH) $(RUNTOP)
|
|
|
|
|
|
|
|
.PHONY: natruntop
|
|
|
|
natruntop:
|
2017-10-18 02:57:19 -07:00
|
|
|
$(MAKE) core
|
|
|
|
$(MAKE) opt
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) ocamlnat
|
|
|
|
@rlwrap --help 2>/dev/null && $(EXTRAPATH) rlwrap $(NATRUNTOP) ||\
|
|
|
|
$(EXTRAPATH) $(NATRUNTOP)
|
|
|
|
|
|
|
|
# Native dynlink
|
|
|
|
|
2019-03-19 03:26:35 -07:00
|
|
|
otherlibs/dynlink/dynlink.cmxa: otherlibs/dynlink/native/dynlink.ml
|
2017-02-08 04:41:36 -08:00
|
|
|
$(MAKE) -C otherlibs/dynlink allopt
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# The lexer
|
|
|
|
|
|
|
|
parsing/lexer.ml: parsing/lexer.mll
|
2019-05-07 02:32:05 -07:00
|
|
|
$(CAMLLEX) $(OCAMLLEX_FLAGS) $<
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f parsing/lexer.ml
|
|
|
|
|
|
|
|
beforedepend:: parsing/lexer.ml
|
|
|
|
|
|
|
|
# The bytecode compiler compiled with the native-code compiler
|
|
|
|
|
|
|
|
ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
|
|
|
|
$(BYTESTART:.cmo=.cmx)
|
2018-09-06 07:12:42 -07:00
|
|
|
$(CAMLOPT_CMD) $(LINKFLAGS) -o $@ $^ -cclib "$(BYTECCLIBS)"
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f ocamlc.opt
|
|
|
|
|
|
|
|
# The native-code compiler compiled with itself
|
|
|
|
|
|
|
|
ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
|
|
|
|
$(OPTSTART:.cmo=.cmx)
|
2018-09-06 07:12:42 -07:00
|
|
|
$(CAMLOPT_CMD) $(LINKFLAGS) -o $@ $^
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f ocamlopt.opt
|
|
|
|
|
|
|
|
# The predefined exceptions and primitives
|
|
|
|
|
2018-06-20 08:43:29 -07:00
|
|
|
runtime/primitives:
|
|
|
|
$(MAKE) -C runtime primitives
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-04-01 09:18:47 -07:00
|
|
|
lambda/runtimedef.ml: lambda/generate_runtimedef.sh runtime/caml/fail.h \
|
2018-10-10 08:16:00 -07:00
|
|
|
runtime/primitives
|
|
|
|
$^ > $@
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
2019-04-01 09:18:47 -07:00
|
|
|
rm -f lambda/runtimedef.ml
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-04-01 09:18:47 -07:00
|
|
|
beforedepend:: lambda/runtimedef.ml
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# Choose the right machine-dependent files
|
|
|
|
|
|
|
|
asmcomp/arch.ml: asmcomp/$(ARCH)/arch.ml
|
|
|
|
cd asmcomp; $(LN) $(ARCH)/arch.ml .
|
|
|
|
|
|
|
|
asmcomp/proc.ml: asmcomp/$(ARCH)/proc.ml
|
|
|
|
cd asmcomp; $(LN) $(ARCH)/proc.ml .
|
|
|
|
|
|
|
|
asmcomp/selection.ml: asmcomp/$(ARCH)/selection.ml
|
|
|
|
cd asmcomp; $(LN) $(ARCH)/selection.ml .
|
|
|
|
|
|
|
|
asmcomp/CSE.ml: asmcomp/$(ARCH)/CSE.ml
|
|
|
|
cd asmcomp; $(LN) $(ARCH)/CSE.ml .
|
|
|
|
|
|
|
|
asmcomp/reload.ml: asmcomp/$(ARCH)/reload.ml
|
|
|
|
cd asmcomp; $(LN) $(ARCH)/reload.ml .
|
|
|
|
|
|
|
|
asmcomp/scheduling.ml: asmcomp/$(ARCH)/scheduling.ml
|
|
|
|
cd asmcomp; $(LN) $(ARCH)/scheduling.ml .
|
|
|
|
|
|
|
|
# Preprocess the code emitters
|
|
|
|
|
|
|
|
asmcomp/emit.ml: asmcomp/$(ARCH)/emit.mlp tools/cvt_emit
|
|
|
|
echo \# 1 \"$(ARCH)/emit.mlp\" > $@
|
|
|
|
$(CAMLRUN) tools/cvt_emit < $< >> $@ \
|
|
|
|
|| { rm -f $@; exit 2; }
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f asmcomp/emit.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/emit.ml
|
|
|
|
|
|
|
|
tools/cvt_emit: tools/cvt_emit.mll
|
|
|
|
$(MAKE) -C tools cvt_emit
|
|
|
|
|
|
|
|
# The "expunge" utility
|
|
|
|
|
|
|
|
expunge: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
|
|
|
|
toplevel/expunge.cmo
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f expunge
|
|
|
|
|
|
|
|
# The runtime system for the bytecode compiler
|
|
|
|
|
|
|
|
.PHONY: runtime
|
2017-03-01 08:26:00 -08:00
|
|
|
runtime: stdlib/libcamlrun.$(A)
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: makeruntime
|
|
|
|
makeruntime:
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all
|
|
|
|
runtime/libcamlrun.$(A): makeruntime ;
|
|
|
|
stdlib/libcamlrun.$(A): runtime/libcamlrun.$(A)
|
|
|
|
cd stdlib; $(LN) ../runtime/libcamlrun.$(A) .
|
2017-02-06 07:46:39 -08:00
|
|
|
clean::
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime clean
|
2019-10-15 03:46:36 -07:00
|
|
|
rm -f stdlib/libcamlrun.a stdlib/libcamlrun.lib
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-03-18 07:05:57 -07:00
|
|
|
otherlibs_all := bigarray dynlink raw_spacetime_lib \
|
|
|
|
str systhreads unix win32unix
|
2018-06-20 08:43:29 -07:00
|
|
|
subdirs := debugger lex ocamldoc ocamltest runtime stdlib tools \
|
2017-08-18 08:30:39 -07:00
|
|
|
$(addprefix otherlibs/, $(otherlibs_all)) \
|
2017-03-06 05:30:40 -08:00
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
.PHONY: alldepend
|
2017-03-06 05:30:40 -08:00
|
|
|
ifeq "$(TOOLCHAIN)" "msvc"
|
|
|
|
alldepend:
|
|
|
|
$(error Dependencies cannot be regenerated using the MSVC ports)
|
|
|
|
else
|
|
|
|
alldepend: depend
|
|
|
|
for dir in $(subdirs); do \
|
2017-04-26 09:23:22 -07:00
|
|
|
$(MAKE) -C $$dir depend || exit; \
|
2017-03-06 05:30:40 -08:00
|
|
|
done
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# The runtime system for the native-code compiler
|
|
|
|
|
|
|
|
.PHONY: runtimeopt
|
2017-03-01 08:26:00 -08:00
|
|
|
runtimeopt: stdlib/libasmrun.$(A)
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: makeruntimeopt
|
|
|
|
makeruntimeopt:
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) allopt
|
|
|
|
runtime/libasmrun.$(A): makeruntimeopt ;
|
|
|
|
stdlib/libasmrun.$(A): runtime/libasmrun.$(A)
|
2017-02-06 07:46:39 -08:00
|
|
|
cp $< $@
|
|
|
|
clean::
|
2019-10-15 03:46:36 -07:00
|
|
|
rm -f stdlib/libasmrun.a stdlib/libasmrun.lib
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# The standard library
|
|
|
|
|
|
|
|
.PHONY: library
|
|
|
|
library: ocamlc
|
|
|
|
$(MAKE) -C stdlib $(BOOT_FLEXLINK_CMD) all
|
|
|
|
|
|
|
|
.PHONY: library-cross
|
|
|
|
library-cross:
|
2018-06-20 08:43:29 -07:00
|
|
|
$(MAKE) -C stdlib $(BOOT_FLEXLINK_CMD) CAMLRUN=../runtime/ocamlrun all
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: libraryopt
|
|
|
|
libraryopt:
|
|
|
|
$(MAKE) -C stdlib $(BOOT_FLEXLINK_CMD) allopt
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
$(MAKE) -C stdlib clean
|
|
|
|
|
|
|
|
# The lexer and parser generators
|
|
|
|
|
|
|
|
.PHONY: ocamllex
|
2019-06-19 09:10:32 -07:00
|
|
|
ocamllex: ocamlyacc
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C lex all
|
|
|
|
|
|
|
|
.PHONY: ocamllex.opt
|
|
|
|
ocamllex.opt: ocamlopt
|
|
|
|
$(MAKE) -C lex allopt
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
$(MAKE) -C lex clean
|
|
|
|
|
|
|
|
.PHONY: ocamlyacc
|
|
|
|
ocamlyacc:
|
|
|
|
$(MAKE) -C yacc $(BOOT_FLEXLINK_CMD) all
|
|
|
|
|
|
|
|
clean::
|
|
|
|
$(MAKE) -C yacc clean
|
|
|
|
|
2017-05-23 08:04:49 -07:00
|
|
|
# The Menhir-generated parser
|
|
|
|
|
|
|
|
# In order to avoid a build-time dependency on Menhir,
|
|
|
|
# we store the result of the parser generator (which
|
|
|
|
# are OCaml source files) and Menhir's runtime libraries
|
2018-09-06 02:02:38 -07:00
|
|
|
# (that the parser files rely on) in boot/.
|
2018-07-14 07:40:01 -07:00
|
|
|
|
2018-09-06 02:02:38 -07:00
|
|
|
# The rules below do not depend on Menhir being available,
|
2018-11-09 11:37:03 -08:00
|
|
|
# they just build the parser from boot/.
|
2018-09-06 02:02:38 -07:00
|
|
|
|
|
|
|
# See Makefile.menhir for the rules to rebuild the parser and update
|
|
|
|
# boot/, which require Menhir. The targets in Makefile.menhir
|
|
|
|
# (also included here for convenience) must be used after any
|
|
|
|
# modification of parser.mly.
|
|
|
|
include Makefile.menhir
|
|
|
|
|
|
|
|
# To avoid module-name conflicts with compiler-lib users that link
|
|
|
|
# with their code with their own MenhirLib module (possibly with
|
|
|
|
# a different Menhir version), we rename MenhirLib into
|
|
|
|
# CamlinternalMenhirlib -- and replace the module occurrences in the
|
|
|
|
# generated parser.ml.
|
|
|
|
|
|
|
|
parsing/camlinternalMenhirLib.ml: boot/menhir/menhirLib.ml
|
|
|
|
cp $< $@
|
|
|
|
parsing/camlinternalMenhirLib.mli: boot/menhir/menhirLib.mli
|
2019-10-14 03:11:01 -07:00
|
|
|
echo '[@@@ocaml.warning "-67"]' > $@
|
|
|
|
cat $< >> $@
|
2018-09-06 02:02:38 -07:00
|
|
|
|
|
|
|
# Copy parsing/parser.ml from boot/
|
2018-09-04 02:51:53 -07:00
|
|
|
|
|
|
|
parsing/parser.ml: boot/menhir/parser.ml parsing/parser.mly \
|
|
|
|
tools/check-parser-uptodate-or-warn.sh
|
2019-09-25 07:54:53 -07:00
|
|
|
@-tools/check-parser-uptodate-or-warn.sh
|
2019-09-25 07:44:00 -07:00
|
|
|
sed "s/MenhirLib/CamlinternalMenhirLib/g" $< > $@
|
2018-08-25 05:46:51 -07:00
|
|
|
parsing/parser.mli: boot/menhir/parser.mli
|
2019-09-25 07:44:00 -07:00
|
|
|
sed "s/MenhirLib/CamlinternalMenhirLib/g" $< > $@
|
2018-07-14 07:40:01 -07:00
|
|
|
|
2019-06-23 23:55:15 -07:00
|
|
|
beforedepend:: parsing/camlinternalMenhirLib.ml \
|
|
|
|
parsing/camlinternalMenhirLib.mli \
|
|
|
|
parsing/parser.ml parsing/parser.mli
|
2018-09-04 02:51:53 -07:00
|
|
|
|
2017-05-23 08:04:49 -07:00
|
|
|
partialclean:: partialclean-menhir
|
|
|
|
|
2018-09-06 02:02:38 -07:00
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
# OCamldoc
|
|
|
|
|
|
|
|
.PHONY: ocamldoc
|
|
|
|
ocamldoc: ocamlc ocamlyacc ocamllex otherlibraries
|
|
|
|
$(MAKE) -C ocamldoc all
|
|
|
|
|
|
|
|
.PHONY: ocamldoc.opt
|
|
|
|
ocamldoc.opt: ocamlc.opt ocamlyacc ocamllex
|
|
|
|
$(MAKE) -C ocamldoc opt.opt
|
|
|
|
|
2017-07-24 02:04:09 -07:00
|
|
|
# OCamltest
|
|
|
|
ocamltest: ocamlc ocamlyacc ocamllex
|
2019-07-30 13:28:59 -07:00
|
|
|
$(MAKE) -C ocamltest all
|
2017-07-24 02:04:09 -07:00
|
|
|
|
|
|
|
ocamltest.opt: ocamlc.opt ocamlyacc ocamllex
|
2019-07-30 13:28:59 -07:00
|
|
|
$(MAKE) -C ocamltest allopt
|
2017-07-24 02:04:09 -07:00
|
|
|
|
|
|
|
partialclean::
|
|
|
|
$(MAKE) -C ocamltest clean
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
# Documentation
|
|
|
|
|
|
|
|
.PHONY: html_doc
|
|
|
|
html_doc: ocamldoc
|
2017-03-05 12:35:47 -08:00
|
|
|
$(MAKE) -C ocamldoc $@
|
2017-02-06 07:46:39 -08:00
|
|
|
@echo "documentation is in ./ocamldoc/stdlib_html/"
|
|
|
|
|
2019-07-27 12:22:57 -07:00
|
|
|
.PHONY: manpages
|
|
|
|
manpages:
|
|
|
|
$(MAKE) -C ocamldoc $@
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
partialclean::
|
|
|
|
$(MAKE) -C ocamldoc clean
|
|
|
|
|
|
|
|
# The extra libraries
|
|
|
|
|
|
|
|
.PHONY: otherlibraries
|
|
|
|
otherlibraries: ocamltools
|
2018-11-06 01:23:49 -08:00
|
|
|
$(MAKE) -C otherlibs all
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
.PHONY: otherlibrariesopt
|
|
|
|
otherlibrariesopt:
|
2018-11-06 01:23:49 -08:00
|
|
|
$(MAKE) -C otherlibs allopt
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
2018-11-06 01:23:49 -08:00
|
|
|
$(MAKE) -C otherlibs partialclean
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
clean::
|
2018-11-06 01:23:49 -08:00
|
|
|
$(MAKE) -C otherlibs clean
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# The replay debugger
|
|
|
|
|
|
|
|
.PHONY: ocamldebugger
|
|
|
|
ocamldebugger: ocamlc ocamlyacc ocamllex otherlibraries
|
|
|
|
$(MAKE) -C debugger all
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
$(MAKE) -C debugger clean
|
|
|
|
|
2019-04-28 01:00:57 -07:00
|
|
|
# Check that the native-code compiler is supported
|
|
|
|
.PHONY: checknative
|
|
|
|
checknative:
|
|
|
|
ifeq "$(ARCH)" "none"
|
|
|
|
checknative:
|
|
|
|
$(error The native-code compiler is not supported on this platform)
|
|
|
|
else
|
|
|
|
@
|
|
|
|
endif
|
|
|
|
|
2017-10-18 02:57:19 -07:00
|
|
|
# Check that the stack limit is reasonable (Unix-only)
|
2017-02-06 07:46:39 -08:00
|
|
|
.PHONY: checkstack
|
|
|
|
checkstack:
|
2017-10-18 02:57:19 -07:00
|
|
|
ifeq "$(UNIX_OR_WIN32)" "unix"
|
2017-03-19 02:50:25 -07:00
|
|
|
if $(MKEXE) $(OUTPUTEXE)tools/checkstack$(EXE) tools/checkstack.c; \
|
2017-02-06 07:46:39 -08:00
|
|
|
then tools/checkstack$(EXE); \
|
|
|
|
fi
|
|
|
|
rm -f tools/checkstack$(EXE)
|
2017-10-19 08:15:52 -07:00
|
|
|
else
|
|
|
|
@
|
2017-02-06 07:46:39 -08:00
|
|
|
endif
|
|
|
|
|
2016-12-08 14:57:31 -08:00
|
|
|
# Lint @since and @deprecated annotations
|
|
|
|
|
2017-08-12 13:20:42 -07:00
|
|
|
VERSIONS=$(shell git tag|grep '^[0-9]*.[0-9]*.[0-9]*$$'|grep -v '^[12].')
|
2016-12-08 14:57:31 -08:00
|
|
|
.PHONY: lintapidiff
|
|
|
|
lintapidiff:
|
|
|
|
$(MAKE) -C tools lintapidiff.opt
|
|
|
|
git ls-files -- 'otherlibs/*/*.mli' 'stdlib/*.mli' |\
|
|
|
|
grep -Ev internal\|obj\|spacetime\|stdLabels\|moreLabels |\
|
2017-11-03 03:38:51 -07:00
|
|
|
tools/lintapidiff.opt $(VERSIONS)
|
2016-12-08 14:57:31 -08:00
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
# Tools
|
|
|
|
|
|
|
|
.PHONY: ocamltools
|
2019-04-01 09:18:47 -07:00
|
|
|
ocamltools: ocamlc ocamllex compilerlibs/ocamlmiddleend.cma
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C tools all
|
|
|
|
|
|
|
|
.PHONY: ocamltoolsopt
|
|
|
|
ocamltoolsopt: ocamlopt
|
|
|
|
$(MAKE) -C tools opt
|
|
|
|
|
|
|
|
.PHONY: ocamltoolsopt.opt
|
2019-04-01 09:18:47 -07:00
|
|
|
ocamltoolsopt.opt: ocamlc.opt ocamllex.opt compilerlibs/ocamlmiddleend.cmxa
|
2017-02-06 07:46:39 -08:00
|
|
|
$(MAKE) -C tools opt.opt
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
$(MAKE) -C tools clean
|
|
|
|
|
|
|
|
## Test compilation of backend-specific parts
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f $(ARCH_SPECIFIC)
|
|
|
|
|
|
|
|
beforedepend:: $(ARCH_SPECIFIC)
|
|
|
|
|
|
|
|
# This rule provides a quick way to check that machine-dependent
|
|
|
|
# files compiles fine for a foreign architecture (passed as ARCH=xxx).
|
|
|
|
|
2017-02-08 06:03:59 -08:00
|
|
|
.PHONY: check_arch
|
2017-02-06 07:46:39 -08:00
|
|
|
check_arch:
|
|
|
|
@echo "========= CHECKING asmcomp/$(ARCH) =============="
|
|
|
|
@rm -f $(ARCH_SPECIFIC) asmcomp/emit.ml asmcomp/*.cm*
|
|
|
|
@$(MAKE) compilerlibs/ocamloptcomp.cma \
|
|
|
|
>/dev/null
|
|
|
|
@rm -f $(ARCH_SPECIFIC) asmcomp/emit.ml asmcomp/*.cm*
|
|
|
|
|
2017-02-08 06:03:59 -08:00
|
|
|
.PHONY: check_all_arches
|
2017-02-06 07:46:39 -08:00
|
|
|
check_all_arches:
|
2018-06-07 05:27:30 -07:00
|
|
|
ifeq ($(ARCH64),true)
|
2017-02-06 07:46:39 -08:00
|
|
|
@STATUS=0; \
|
|
|
|
for i in $(ARCHES); do \
|
|
|
|
$(MAKE) --no-print-directory check_arch ARCH=$$i || STATUS=1; \
|
|
|
|
done; \
|
|
|
|
exit $$STATUS
|
2018-03-20 08:33:58 -07:00
|
|
|
else
|
|
|
|
@echo "Architecture tests are disabled on 32-bit platforms."
|
|
|
|
endif
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
# The native toplevel
|
|
|
|
|
|
|
|
# When the native toplevel executable has an extension (e.g. ".exe"),
|
|
|
|
# provide a phony 'ocamlnat' synonym
|
|
|
|
|
|
|
|
ifneq ($(EXE),)
|
|
|
|
.PHONY: ocamlnat
|
|
|
|
ocamlnat: ocamlnat$(EXE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ocamlnat$(EXE): compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
|
|
|
|
compilerlibs/ocamlbytecomp.cmxa \
|
2019-03-13 03:46:37 -07:00
|
|
|
otherlibs/dynlink/dynlink.cmxa \
|
2017-02-06 07:46:39 -08:00
|
|
|
compilerlibs/ocamlopttoplevel.cmxa \
|
|
|
|
$(OPTTOPLEVELSTART:.cmo=.cmx)
|
2018-09-06 07:12:42 -07:00
|
|
|
$(CAMLOPT_CMD) $(LINKFLAGS) -linkall -o $@ $^
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
2019-10-15 03:46:36 -07:00
|
|
|
rm -f ocamlnat ocamlnat.exe
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
toplevel/opttoploop.cmx: otherlibs/dynlink/dynlink.cmxa
|
|
|
|
|
|
|
|
# The numeric opcodes
|
|
|
|
|
2018-06-20 08:43:29 -07:00
|
|
|
bytecomp/opcodes.ml: runtime/caml/instruct.h tools/make_opcodes
|
|
|
|
runtime/ocamlrun tools/make_opcodes -opcodes < $< > $@
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-02-26 08:17:38 -08:00
|
|
|
bytecomp/opcodes.mli: bytecomp/opcodes.ml
|
|
|
|
$(CAMLC) -i $< > $@
|
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
tools/make_opcodes: tools/make_opcodes.mll
|
|
|
|
$(MAKE) -C tools make_opcodes
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f bytecomp/opcodes.ml
|
2019-02-26 08:17:38 -08:00
|
|
|
rm -f bytecomp/opcodes.mli
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-02-26 08:17:38 -08:00
|
|
|
beforedepend:: bytecomp/opcodes.ml bytecomp/opcodes.mli
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2019-06-18 06:35:06 -07:00
|
|
|
ifneq "$(wildcard .git)" ""
|
|
|
|
include Makefile.dev
|
|
|
|
endif
|
2018-09-07 13:57:32 -07:00
|
|
|
|
2017-02-06 07:46:39 -08:00
|
|
|
# Default rules
|
|
|
|
|
|
|
|
.SUFFIXES: .ml .mli .cmo .cmi .cmx
|
|
|
|
|
|
|
|
.ml.cmo:
|
|
|
|
$(CAMLC) $(COMPFLAGS) -c $<
|
|
|
|
|
|
|
|
.mli.cmi:
|
|
|
|
$(CAMLC) $(COMPFLAGS) -c $<
|
|
|
|
|
|
|
|
.ml.cmx:
|
2019-06-27 09:07:25 -07:00
|
|
|
$(CAMLOPT) $(COMPFLAGS) $(OPTCOMPFLAGS) -c $<
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
partialclean::
|
2019-04-01 09:18:47 -07:00
|
|
|
for d in utils parsing typing bytecomp asmcomp middle_end file_formats \
|
|
|
|
lambda middle_end/closure middle_end/flambda \
|
|
|
|
middle_end/flambda/base_types asmcomp/debug \
|
|
|
|
driver toplevel tools; do \
|
2019-10-15 03:46:36 -07:00
|
|
|
rm -f $$d/*.cm[ioxt] $$d/*.cmti $$d/*.annot $$d/*.s $$d/*.asm \
|
|
|
|
$$d/*.o $$d/*.obj $$d/*.so $$d/*.dll; \
|
2017-02-06 07:46:39 -08:00
|
|
|
done
|
|
|
|
|
|
|
|
.PHONY: depend
|
|
|
|
depend: beforedepend
|
|
|
|
(for d in utils parsing typing bytecomp asmcomp middle_end \
|
2019-04-01 09:18:47 -07:00
|
|
|
lambda file_formats middle_end/closure middle_end/flambda \
|
|
|
|
middle_end/flambda/base_types asmcomp/debug \
|
|
|
|
driver toplevel; \
|
|
|
|
do $(CAMLDEP) $(DEPFLAGS) $(DEPINCLUDES) $$d/*.mli $$d/*.ml || exit; \
|
|
|
|
done) > .depend
|
2017-02-06 07:46:39 -08:00
|
|
|
|
2017-02-15 01:32:58 -08:00
|
|
|
.PHONY: distclean
|
2017-02-06 07:46:39 -08:00
|
|
|
distclean: clean
|
2019-10-15 03:46:36 -07:00
|
|
|
rm -f boot/ocamlrun boot/ocamlrun boot/ocamlrun.exe boot/camlheader \
|
|
|
|
boot/*.cm* boot/libcamlrun.a boot/libcamlrun.lib boot/ocamlc.opt
|
2020-04-17 05:53:49 -07:00
|
|
|
rm -f Makefile.config Makefile.build_config
|
|
|
|
rm -f runtime/caml/m.h runtime/caml/s.h
|
2018-12-04 03:01:52 -08:00
|
|
|
rm -rf autom4te.cache
|
|
|
|
rm -f config.log config.status libtool
|
2019-11-15 04:52:35 -08:00
|
|
|
rm -f tools/eventlog_metadata
|
2017-02-06 07:46:39 -08:00
|
|
|
rm -f tools/*.bak
|
|
|
|
rm -f ocaml ocamlc
|
2018-03-20 23:52:38 -07:00
|
|
|
rm -f testsuite/_log*
|
2017-02-06 07:46:39 -08:00
|
|
|
|
|
|
|
include .depend
|
2019-09-30 07:01:29 -07:00
|
|
|
|
2019-10-15 04:04:19 -07:00
|
|
|
|
|
|
|
ifneq "$(strip $(CAN_BE_UNCONFIGURED))" ""
|
2020-04-17 05:53:49 -07:00
|
|
|
Makefile.config Makefile.build_config: config.status
|
2019-11-12 04:52:41 -08:00
|
|
|
|
|
|
|
config.status:
|
2019-09-30 07:01:29 -07:00
|
|
|
@echo "Please refer to the installation instructions:"
|
|
|
|
@echo "- In file INSTALL for Unix systems."
|
|
|
|
@echo "- In file README.win32.adoc for Windows systems."
|
|
|
|
@echo "On Unix systems, if you've just unpacked the distribution,"
|
|
|
|
@echo "something like"
|
|
|
|
@echo " ./configure"
|
|
|
|
@echo " make"
|
|
|
|
@echo " make install"
|
|
|
|
@echo "should work."
|
|
|
|
@false
|
2019-10-15 04:04:19 -07:00
|
|
|
endif
|