Skip to content

Conversation

@shindere
Copy link
Contributor

This PR continues the work started in #11243, #11248, #11268, #11420,
#11675, #12198 and #12321. The present PR is however slightly different from
the previous ones in the sense that the Makefile it merges was included in
the root Makefile rather than recursively called by it, meaning
that this PR does not change the dependency graph or the number of
recursive invocations of Make.

This PR however introduces a general framework to build libraries, similar
to the one already in place to build programs. It is expected that this
framework can be used also to build ocamldoc's generators, the other
libraries and the standard library itself.

In particular, this framework is flexible enough to deal with libraries
whose bytecode and native versions are built from different lists
of source files, as is the case for the ocamltoplevel library.
This is achieved by listing all the source files that appear in
at least one version of the library in its associated _SOURCES
variable. The framework then filters out the files matching /native/
when building the bytecode library, and vice versa.

Finally, the dependencies on MLI-only modules previously handled through the
GROUP_CMI variables are handled correctly: the libraries are made to
depend on all the .cmi files whose names can be derived from the .mli
files listed in the _SOURCES variable. This works whether the .cmi files
are for interface-only modules or not and it is fine to add regular .cmi
files to the list of dependencies because they were there already
transitively, so adding them does not change the transitive closure
of the dependency grpah.

@dra27 dra27 self-assigned this Sep 20, 2023
@shindere shindere force-pushed the merge-compilerlibs-makefile branch 2 times, most recently from 04078a7 to 90cf645 Compare September 29, 2023 12:47
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of the libraries part looks like a very logical continuation of the previous framework for the programs (nicely hinting that this is all on a good track). A few comments - the major contention may be that I think for the compilerlibs it is probably better to stick with listing explicit directories for every file (as Makefile.compilerlibs does at the moment).

@shindere shindere force-pushed the merge-compilerlibs-makefile branch from 90cf645 to 2248d9e Compare October 18, 2023 09:24
@shindere
Copy link
Contributor Author

shindere commented Oct 18, 2023 via email

Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few further comments - the rest we can pick up later

@shindere
Copy link
Contributor Author

shindere commented Oct 18, 2023 via email

@shindere shindere force-pushed the merge-compilerlibs-makefile branch 2 times, most recently from c1254e8 to 7a8038f Compare October 18, 2023 17:25
@shindere
Copy link
Contributor Author

I believe that the current branch addresses the two issues remaining from earlier today:

  • Replace the FIXME comment by documentation about why this dependency is there
  • Add a commit to ensure that all .cmx file depend on the native compiler so that they get rebuilt if the compiler is updated

As announced, once the branch is good to go I will rewrite the history slightly and basically squash all the commits that were created during the review process into the earlier ones. I intend to keep the current head commit of the branch, though, because (1) it does have a semantics on its own and (2) it touches both Makefile.common and the root Makefile, which is something none of the previous commits in this branch does.

Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you rebase onto the same base trunk commit, these can all be addressed while squashing the history

@shindere shindere force-pushed the merge-compilerlibs-makefile branch from 7a8038f to 8f56709 Compare October 19, 2023 09:29
@shindere
Copy link
Contributor Author

shindere commented Oct 19, 2023 via email

@shindere shindere force-pushed the merge-compilerlibs-makefile branch from 8f56709 to 8205949 Compare October 19, 2023 09:46
@shindere shindere force-pushed the merge-compilerlibs-makefile branch from 8205949 to da035ff Compare October 19, 2023 09:49
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dra27 dra27 added the merge-me label Oct 19, 2023
@shindere
Copy link
Contributor Author

shindere commented Oct 19, 2023 via email

@shindere shindere merged commit 14a3ce6 into ocaml:trunk Oct 19, 2023
@shindere shindere deleted the merge-compilerlibs-makefile branch October 19, 2023 10:42
shindere added a commit that referenced this pull request Nov 22, 2023
The compilerlibs were no longer compiled with -linkall, due to a
bogous line introduced in commit e1c2928,
which was part of PR #12586 (Merge compilerlibs/Makefile.compilerlibs
into the root Makefile).

The line was using a wrong GNU make syntax and a wrong variable name.

The present commit fixes both the syntax and the variable name.
@shindere
Copy link
Contributor Author

I just direct-pushed db68f24 to fix a bogous line introduced by commit e1c2928 which belongs to this PR.

The problem has been discovered independently by @xavierleroy and myself.

I initially fixed it in PR #12706 but then followed Xavier's suggestion
to push it independently and directly.

Will now rebase #12706 on top of repaired trunk.

@xavierleroy
Copy link
Contributor

I just direct-pushed db68f24 to fix a bogous line introduced by commit e1c2928 which belongs to this PR.

Thanks a lot ! I rebased my PR #12758, which was affected too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants