Makefile.dev is only included if a Git clone is detected.
make evaluates macros in target specifications when the Makefile is
read, which meant that the build-all-asts target caused `git ls-files`
to be called on every invocation of make. This tweaks it to be a
recursive call to make which puts the $(AST_FILES) macro in the recipe
where it is only evaluated when the target is requested.
This commit makes e.g. make -s world.opt completely
silent when everything works, in order to increase the visibility of
any unexpected message occurring during the build.
This will be useful for instance during CI, in particular it should
make it easier to catch undefined build variables.
The implementation is straightforward. The OCAMLLEX_FLAGS variable is
defined in Makefile.common.in and then used consistently by all
lexing recipes.
In addition, in tools/Makefile, the two rules producing the lexers
from cvt_emit.mll and make_opcodes.mll have been replaced by a
pattern-rule and the useless .SUFFIXES target has been removed.
Previously, if the native-code compiler is not supported
(e.g. because configure doesn't recognize the target architecture,
or is run with --disable-native-compiler), "make world.opt"
fails late and with a mysterious error message
(a warning about undeclared C functions in runtime/roots_nat.c
or runtime/backtrace_nat.c, typically).
This commit ensures that "make world.opt", "make opt" and "make opt.opt"
fail immediately with a meaningful error message if the native-code
compiler is not supported.
Note: in "world.opt", make sure that "checknative" is run, and only
then "coldstart"; don't run them in parallel.
* Various file moves in the middle end: this is the first stage of improving separation between the middle end and backend.
* Creation of file_formats/ directory (with associated file moves) to hold the definitions of compilation artifact formats.
* Creation of lambda/ directory (with associated file moves) to hold Lambda language definition files, transformation passes and construction passes from Typedtree.
* Disable (hopefully temporarily) dynlink, debugger and ocamldoc for the dune build.
The Graphics library is now distributed as a separate package.
The sources are at https://github.com/ocaml/graphics .
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
After consultation on the core developers' list I am proposing this patch to remove support for compiler plugins.
The main motivations for removing compiler plugins are:
- They are a potential security risk.
- They increase the complexity of the build system and make maintenance of the Dynlink libraries more difficult (although actually, this complexity could probably be reduced after #2268 is merged).
- Many applications of plugins should be able to be expressed by building custom compiler drivers that link against compilerlibs.
* Remove compiler plugins and hooks
* Add new function Dynlink.unsafe_get_global_symbol but keep it outside the documented API.
* Remove otherlibs/dynlink/nodynlink.ml
* Update Changes
Persistent_env is a new module that handles the relation between the
type-checking state and the "persistent" typing information laying in
.cmi files on the filesystem. In particular, it handles the collection
and production of CRC information for the .cmi files being read and
written to the filesystem; the using modules (in our case, only Env)
are in charge of turning the cmi files into higher-level information
(components and signatures).
Persistent_env exposes a type `'a t` of a persistent environment,
which acts as a mutable store of `'a` values. There is no global state
in the module itself: while Env (and thus the OCaml type-checker) uses
a single global persistent environment, it should be possible to
create several independent environments to represent, for example,
several independent type-checking sessions.
- Add a Load_path module which caches files lookup
- Instead of falling back to the external environment, allow to
declare in the environment that a module comes from the external
world. This allows persistent structures to shadows non-persistent
ones
This change should be a refactoring no-op.
Before, a DEPFLAGS variable existed in some makefiles to contain
include directories to be passed to ocamldep invocations, but no
support for easily adding command-line flags to ocamldep was available
(invocations would systematically use -slash, which was duplicated
across callsites).
With this PR, a new DEPINCLUDES variable contains the include
directories, and DEPFLAGS is repurposed to contain other command-line
flags for the tool -- currently "slash".
get_unboxed_type_representation is used in several other modules, and
split into its own Typedecl_unboxed unit.
(pair-programming with Gabriel Scherer)
used by `make build-all-asts` and related commands.
Indeed, the idea is to check that the ASTs do not change when the parser is
modified -- the parser's source itself, if included, would always produce a
false positive.
- The code responsible for printing Syntaxerr errors is moved to the
Parse module (so that it can depend on the variable printer in
Pprintast).
- Pprintast becomes a dependency for a few tools that link some
compiler modules in an ad hoc way (they would better be implemented
in terms of compiler-libs).
In order to prepare the transition to autoconf, this commit moves the
configuration Makefile out of the config directory which will disappear
and gives it the name it will have once intstalled, namely Makefile.config.
This subdirectory was used to store experimental patches on some older
version-control system where branching (or discussing branches?) was
inconvenient. It doesn't make much sense anymore now, and getting rid
of it simplifies a couple places that had to grow around it.
Suggested-by: Nicolás Ojeda Bär
(no change entry needed)
If an error occurs while making flexlink.opt, the bytecode image was not
restored. It's now restored even if an error occurs while building the
native code image.
Some Makefiles were using export to set OCAML_FLEXLINK "globally" while
others set a variable FLEXLINK_ENV and set the environment explicitly.
All Makefiles now use FLEXLINK_ENV and also only invoke it on linking
commands (rather than, for example, all invocations of ocamlopt).
The large diff in boot/menhir/parser_menhir.ml comes from the fact
that the token list is now included in it, instead of being merely
a reference to the yacc parsers' Parser.token type.
The goal of this change is to avoid conflicts encountered by
compiler-libs users that would also use their own MenhirLib runtime
for their own parsers.
I first tried to implement a solution to this module-name-conflict
issue using module aliases and -open, but this proven too fragile and
too difficult to get right.
Uses the new $symbolstartpos feature of Menhir
to get locations identical to the OCamlYacc ones.
REBASE POINT: at the point of this commit, using a diff program
on parser.mly and parser_menhir.mlyp should give identical results
after the header code. If you rebase the Menhir-parser patchset
against a newer ocamlyacc parser (parser.mly), those two files
will have diverged, and you need to merge the parser.mly change
back into parser_menhir.mlyp -- and then deal with them in the
rest of the patch series.
- Introduce `-dcamlprimc`, to keep the generated C file containing the primitive list
- Use `-fdebug-prefix-map` for compiling temporary C files when this option is supported
This commit renames a few C compiler related build variables so that
they are reserved for the build system. They will then be re-introduced,
but this time as user varialbes whose value can be freely customized
when compiling the package, without risking to conflict with those
command-line flags that are required by the build system itself.
Here are the variables this commit renames:
- CFLAGS -> OC_CFLAGS
- CPPFLAGS -> OC_CPPFLAGS
- LDFLAGS -> OC_LDFLAGS
Note: before this commit the compilation of scheduler.c in
otherlibs/threads was relying on make's implicit rule to compile C files.
Since this commit stops using the standard variables for flags,
it is necessary to introduce an explicit rule to compile C files
and that makes use of the newly introduced variables.
* Remove the now obsolete comments at the beginning of the main Makefile
* Move and fix documentation of the bootstrap from INSTALL to
HACKING-bootstrap.adoc
* Update install instructions
This commit contains the following fixes and enhancements to the
root Makefile:
* coreall: add dependency on runtime
* all: before this commit, this target was depending on runtime and started
by making coreall. This commit simplifies this and just makes this target
depend on coreall, which is both simpler and semantically more accurate.
* compare: let this target exit if the comparison fails
* bootstrap: this commit removes the final invocation to make compare.
The comparison was actually done twice, (1) as the final step of coreboot
and (2) as the final step of bootstrap. The motivation for that was to
ensure that the comparison messages were not lost and did appear last.
Actually, it turns out that if the comparison fails, it makes no
sense to continue the bootstrap process. That's why compare now exits
immediately when it fails and there is thus no need to perform it twice.
* Get rid of backup and restore targets which have become obsolete
with the use of a revision control system
This tool is used to compile ocamlc. Given that make_opcodes is itself
recompiled as part of the bootstrap process, it needs to be run on the new
(rather than old) runtime. In other words, make_opcodes needs to be run
using byterun/ocamlrun rather than boot/ocamlrun.
This commit fixes this.
The compiler's bootstrap procedure involves calling the promote-cross
target of the root Makefile.
When this target is invoked e.g. in the context of an executable
magic number update, it is actually not possible to use the stripdebug
tool.
Thus, this commit makes sure the promote-cross target uses cp
to promote the bytecode tools, rather than stripdebug.
This is not an issue because in the promote rule used later
during the bootstrap the stripdebug tool can be used, so that the
bytecode executables one gets after a complete bootstrap will remain
small and won't contain any debugging symbol.