Commit Graph

113 Commits (fab58a938a61c62bb66ed70ce2563e1657d9f53b)

Author SHA1 Message Date
Gabriel Scherer fab58a938a makefiles: move the inclusion of Makefile.build_config in Makefile.common 2020-05-06 12:10:02 +02:00
David Allsopp 617522ec95 Restore compatibility with GNU make 3.81
It's the macOS default installed version still. The dependency generation
inadvertently relies on behaviour introduced in GNU make 3.82 a decade ago.

The fix in otherlibs/systhreads/Makefile also corrects missing
NATIVE_CPPFLAGS when generating st_stubs.n.d, so st_stubs.n.o now
correctly depends on caml/stacks.h instead of caml/stack.h
2020-05-03 16:00:28 +01:00
David Allsopp 7cfd81073e Remove unnecessary -MG from systhreads
It's use in runtime/Makefile is also clarified.
2020-05-01 10:33:48 +01:00
David Allsopp ac2a9dd188 Cease committing C dependendency information
When building for the first time, the only requirement is that generated
header files have been built (jumptbl.h, version.h and opnames.h).
Detailed dependency information is only required when headers have been
edited.

COMPUTE_DEPS in Makefile.config controls whether C dependency
information should be generated on a per-file basis. This variable is
controlled by a new --disable-dependency-generation in configure which
is enabled for Git checkouts and disabled for tarballs (i.e. releases).

The Microsoft C compiler (cl) cannot generate dependencies in a
consistent way which we can consume, so for a Git checkout configure
searches for an additional C compiler in order to compute dependencies.
This is obviously not required for a user-build.

As a result, the MSVC port can now safely run make alldepend, since only
OCaml dependency information is committed to the repo after this change.

CI does not need to waste time testing the dependency information,
because it only tests a single build. A single Travis job has been added
which tests the build system code to generate the dependency information
(and provides a single `make -j` run in CI, although Inria's CI also
tests parallel building continuously).
2020-04-17 14:11:22 +01:00
David Allsopp 3a40b2fd94 Introduce Makefile.build_config.in
This moves the configure-generated parts of Makefile.common to a
separate (generated) Makefile, allowing Makefile.common to be a normal
Makefile.

OCaml's build system Makefile's now include Makefile.build_config (which
itself includes Makefile.config) but Makefile.config is still installed
as before. This allows configure to generate variables which are
specific to the build process and are not intended to be exported to the
installation.
2020-04-17 13:53:49 +01:00
Greta Yorsh 7271919a47 Check FLAMBDA in Makefile.common.in to update OPTCOMPFLAGS 2020-04-20 13:56:53 +01:00
Greta Yorsh 44af4aea7c Check FUNCTION_SECTIONS in Makefile.common.in to update OPTCOMPFLAGS 2020-04-20 13:56:53 +01:00
Greta Yorsh 7465e9f2c7 Define OPTCOMPFLAGS in Makefile.common.in 2020-04-20 13:56:53 +01:00
Greta Yorsh ec03b06ad2 Add -function-sections to missing folder in otherlibs 2020-04-20 13:56:53 +01:00
David Allsopp 13786d7d12 Ensure make distclean works on an unconfigured tree 2019-10-15 11:46:36 +01:00
David Allsopp d4a566573f Allow make to be invoked before configure
This should be improved to give better warnings for when Makefile.config
and Makefile.common are required.
2018-12-04 10:28:36 +00:00
Gabriel Scherer 879ddff59a otherlibs Makefiles: use ocaml{c,opt}.opt when available
On my machine, the sequential build time goes from 30s to 10s.
2019-10-12 10:23:29 +02:00
Sébastien Hinderer 5ec649f0cb
Build system: share rules to compile C files (#8930)
This commit deduplicates some of the Makefile rules used to compile C files.

Rather than having one such rule per Makefile for each directory
containing C files, the relevant rules are moved to Makefile.common.in.
2019-09-11 09:16:15 +02:00
Sébastien Hinderer 8550f71441 Build system: use $(ROOTDIR) rather than hardcoded paths to access ocamlc 2019-01-03 17:02:25 +01:00
Sébastien Hinderer d258bb78ac Build system: use ocamlc -depend rather than ocamldep 2019-01-03 16:43:23 +01:00
Sébastien Hinderer ba6362a07d Move config/Makefile to Makefile.config
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.
2018-09-17 14:23:35 +02:00
David Allsopp b069f692b4 Remove space from end of FLEXLINK_ENV 2018-09-07 08:34:53 +02:00
David Allsopp 4756a576f0 Move FLEXLINK_ENV definition to Makefile.common 2018-09-07 08:34:53 +02:00
David Allsopp c13c200f87 Standardise setting and use of OCAML_FLEXLINK
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).
2018-09-07 08:34:53 +02:00
Gabriel Scherer ac265e9ea3 (minor) remove unused CAMLYACC variables 2018-09-01 23:17:06 +02:00
Valentin Gatien-Baron 71f20ee78a install the mli files of the thread library next to its cmi/cmt/etc
Here is the diff in the installation directory, limited to the condition module:
-./lib/ocaml/condition.mli
 ./lib/ocaml/threads/condition.cmi
 ./lib/ocaml/threads/condition.cmti
 ./lib/ocaml/threads/condition.cmx
+./lib/ocaml/threads/condition.mli
 ./lib/ocaml/vmthreads/condition.cmi
 ./lib/ocaml/vmthreads/condition.cmti
 ./lib/ocaml/vmthreads/condition.mli

and overall:

@@ -1300,7 +1300,6 @@
 ./lib/ocaml/complex.mli
 ./lib/ocaml/complex.p.cmt
 ./lib/ocaml/complex.p.cmx
-./lib/ocaml/condition.mli
 ./lib/ocaml/digest.cmi
 ./lib/ocaml/digest.cmt
 ./lib/ocaml/digest.cmti
@@ -1324,7 +1323,6 @@
 ./lib/ocaml/ephemeron.mli
 ./lib/ocaml/ephemeron.p.cmt
 ./lib/ocaml/ephemeron.p.cmx
-./lib/ocaml/event.mli
 ./lib/ocaml/expunge
 ./lib/ocaml/extract_crc
 ./lib/ocaml/filename.cmi
@@ -1471,7 +1469,6 @@
 ./lib/ocaml/moreLabels.mli
 ./lib/ocaml/moreLabels.p.cmt
 ./lib/ocaml/moreLabels.p.cmx
-./lib/ocaml/mutex.mli
 ./lib/ocaml/nativeint.cmi
 ./lib/ocaml/nativeint.cmt
 ./lib/ocaml/nativeint.cmti
@@ -1774,27 +1771,30 @@
 ./lib/ocaml/sys.p.cmx
 ./lib/ocaml/target_camlheaderd
 ./lib/ocaml/target_camlheaderi
-./lib/ocaml/thread.mli
 ./lib/ocaml/threads
 ./lib/ocaml/threads/condition.cmi
 ./lib/ocaml/threads/condition.cmti
 ./lib/ocaml/threads/condition.cmx
+./lib/ocaml/threads/condition.mli
 ./lib/ocaml/threads/event.cmi
 ./lib/ocaml/threads/event.cmti
 ./lib/ocaml/threads/event.cmx
+./lib/ocaml/threads/event.mli
 ./lib/ocaml/threads/mutex.cmi
 ./lib/ocaml/threads/mutex.cmti
 ./lib/ocaml/threads/mutex.cmx
+./lib/ocaml/threads/mutex.mli
 ./lib/ocaml/threads/thread.cmi
 ./lib/ocaml/threads/thread.cmti
 ./lib/ocaml/threads/thread.cmx
+./lib/ocaml/threads/thread.mli
 ./lib/ocaml/threads/threads.a
 ./lib/ocaml/threads/threads.cma
 ./lib/ocaml/threads/threads.cmxa
 ./lib/ocaml/threads/threadUnix.cmi
 ./lib/ocaml/threads/threadUnix.cmti
 ./lib/ocaml/threads/threadUnix.cmx
-./lib/ocaml/threadUnix.mli
+./lib/ocaml/threads/threadUnix.mli
 ./lib/ocaml/topdirs.cmi
 ./lib/ocaml/topdirs.cmt
 ./lib/ocaml/topdirs.cmti
2018-07-01 07:50:33 -04:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +02:00
Sébastien Hinderer 85fa27f7e9 Rename C compiler related build variables
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.
2018-06-20 14:01:42 +02:00
Sébastien Hinderer a10a3f5806 Rename build variable SHAREDCCCOMPOPTS to SHAREDLIB_CFLAGS 2018-06-20 14:01:42 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
Mark Shinwell ea2d6a1e31
Add configure options to control installation of source artifacts (#1777) 2018-05-14 08:15:44 +01:00
Gabriel Scherer 3702f53692 factorize common makefile definitions in Makefile.common 2018-03-29 17:04:05 +02:00
Gabriel Scherer afcd29eb0c makefiles: turn the 'install' command into a variable
(Suggestion made by Sébastien Hinderer during review.)
2018-03-29 14:40:23 +02:00
Gabriel Scherer ecfd39f127 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-29 14:40:22 +02:00
David Allsopp 6479a259bb Remove unused CCOUTPUT in systhreads Makefile 2017-10-25 23:54:39 +01:00
Sébastien Hinderer b08deacf18 configure should define the CPP build variable
The CPP variable tells the build system how to invoke the C preprocessor.

Before this commit, this variable was defined by the Windows Makefiles
but not by the Makefile generated by configure. This commit fixes this.

This commit also fixes a few makefiles: to compute dependencies for C files,
they incorrectly called $(CPP) -MM instead of $(CC) -MM.
2017-09-18 17:40:14 +02:00
Sébastien Hinderer 3564aade19 Introduce and use the OUTPUTEXE and OUTPUTOBJ build variables 2017-03-29 11:10:06 +02:00
Sébastien Hinderer f2d5d60376 Define new build variables for C compiler and preprocessor flags 2017-03-29 11:10:06 +02:00
Sébastien Hinderer cc7ad5650a Get rid of BYTECC and NATIVECC
Use the same C compiler, CC, in all the build system.
2017-03-29 11:10:06 +02:00
Sébastien Hinderer dfb33a6b83 Fix dependencies in otherlibs/systhreads
Before this commit, the dependencies computed for st_stubs were
useless because they were generated for st_stubs.o whereas what is actually
built is st_stubs_b.o and st_stubs_n.o.
2017-03-09 17:12:02 +01:00
Sébastien Hinderer a85b39654a Clearly report that dependencies cannot be regenerated for the MSVC ports 2017-03-09 17:12:02 +01:00
David Allsopp fbdddb2205 Fix systhreads installation on Windows
812eb68de9 didn't quote the path!
2017-02-01 10:36:23 +00:00
Jeremie Dimino 812eb68de9 Reinstate installation of dllthreads$(EXT_DLL)
It was accidently dropped by 5c4c41ba
2017-01-27 17:48:48 +00:00
David Allsopp 683ef70001 Clean DLLs in otherlibs/systhreads
ocamlmklib produces bytecode dynamic link libraries for the threads
library but these are (intentionally) not installed.

The cleaning of them got lost in the merge of the two build systems.
2016-12-14 13:14:21 +00:00
Gabriel Scherer 3b034f5150 Merge pull request #893 from dra27/fix-flexlink-bootstrap
Fix bootstrapping flexlink
2016-11-06 11:04:37 -05:00
David Allsopp fb9636d16f Fix bootstrapping flexlink
5c4c41 accidentally broke building otherlibs/systhreads with a
bootstrapped flexlink.
2016-11-06 14:12:08 +00:00
hendriktews 0bb16e0934 improve installation of additional material (#827)
- install missing mli and cmti files for compiler-libs and otherlibs
- new make target install-compiler-sources to install compiler-libs ml files
2016-10-21 16:40:14 +02:00
Hongbo Zhang 821361efce fix solaris build (#841) 2016-10-12 16:04:33 +02:00
Sébastien Hinderer 4f1922049f Allow parallel build of native and bytecode stubs of the systhreads library. (#811)
Before this commit, it was not possible to build the object files for
st_stubs_b and st_stubs_n in parallel, because both builds were performed
by first building an st_stubs object file and then renaming it, resulting
in a filename clash in case of parallel build.

This commit fixes this situation by giving the C compiler the right options
so that object files are created with the right name from the beginning
and do not need to be renamed afterwards.
2016-09-15 00:38:03 +02:00
Sébastien Hinderer 5c4c41ba10 Merge makefiles in otherlibs/systhreads (#785)
* Make sure the PTHREAD_CAML_LINK variable is defined everywhere.

* Merge makefiles in otherlibs/systhreads

Before this commit, the .cma and .cmxa libraries were linked using -linkall
under Windows but not under Unix.

It was not possible to clarify why -linkall was useful, but given the small
size of the involved modules and the fact that, for most modules, it
does not seem to make much sense to use one without the others, it has been
decided to use -linkall everywhere.

This commit also stops building the .cmxs shared library under Windows, for
consistency reasons (it was built only under Windows before).
2016-09-13 17:59:47 +02:00
alainfrisch c1ead896a2 Pass -slash to ocamldep so that dependencies generated from a Windows system are closer to those generated from a Unix system. 2016-04-13 17:04:15 +02:00
Damien Doligez d5f61a4e54 tweak tools/check-typo and break more overlong lines 2016-02-19 12:28:36 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Mark Shinwell 0665172cfe Build stdlib, etc. with -O3 in Flambda mode 2016-02-11 11:18:45 +00:00
Xavier Leroy 8815d7e1a2 PowerPC port of ocamlopt:
- Removed MacOS X support, long dead.
- Added support for PowerPC 64 bits, big-endian, ELF v1 ABI
  (tested, mostly works, some issues remain with marshaling of code pointers)
- Added support for PowerPC 64 bits, little-endian, ELF v2 ABI
  (completely untested)


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/ppc64@16226 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-07-20 15:41:44 +00:00