Skip to content

configure/Makefile: Makefile.common is not .in anymore#9453

Closed
gasche wants to merge 3 commits intoocaml:trunkfrom
gasche:Makefile.common-is-not-.in-anymore
Closed

configure/Makefile: Makefile.common is not .in anymore#9453
gasche wants to merge 3 commits intoocaml:trunkfrom
gasche:Makefile.common-is-not-.in-anymore

Conversation

@gasche
Copy link
Copy Markdown
Member

@gasche gasche commented Apr 17, 2020

Makefile.common was generated by ./configure just to get the value of the INSTALL variable. This PR moves the INSTALL variable to Makefile.config, and stops configure-generating Makefile.common. I think it is nicer and easier if only Makefile.config is generated by ./configure.

(cc @dra27 @shindere)

For me configure-generated files are a constant source of interface issues during my development: I go update the generated one, it doesn't show up in my git status, then I need to realize what I did wrong and figure out how to fix it. It's a small pain but it comes up often, and these add up to a real inconvenience. This is my reason for getting rid of Makefile.common.in.

To understand how configure sets INSTALL, I went to see the autoconf documentation on AC_PROG_INSTALL and I realized that it also defines variable INSTALL_DATA and INSTALL_PROGRAM, making the exact same distinction we introduced in #1680. I thus changed our own INSTALL_DATA and INSTALL_PROG variables to use the autoconf definitions, instead of redoing it on our own.

Finally: the change touches a lot of file because having a generated Makefile.common induces a surprising amount of bureaucratic ceremony (in particular, @dra27 was careful to use -include instead of include on this file so that our Makefiles work before configure has run, and I decided to be brave and undo all of that). I think that this invasiveness is not a downside of the present PR; on the contrary, it highlights that each configure-generated file is a pain to deal with, so it supports the idea of the PR.

@dra27
Copy link
Copy Markdown
Member

dra27 commented Apr 17, 2020

I'm just about to do a full review, but just to say that I wholly support this - I got burned just yesterday by updating Makefile.common instead of Makefile.common.in

Copy link
Copy Markdown
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.

This is all good. I have one thought, though. Rather than moving these to Makefile.config.in, might it be worth having Makefile.internal-config.in (which would mean keeping the include Makefile.common lines you've restored and restoring the deleted -include with a new name). The issue - and it might be why @shindere created Makefile.common.in in the first place (??) - is that we leak these definitions to anyone who includes the installed Makefile.config on an OCaml system. I expect this is much less common than it used to be (because make isn't used as much for OCaml projects), but I think Sebastien's original hope was to clean up definitions in Makefile.config.

@shindere
Copy link
Copy Markdown
Contributor

shindere commented Apr 17, 2020 via email

@shindere
Copy link
Copy Markdown
Contributor

shindere commented Apr 17, 2020 via email

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Apr 17, 2020

The "inclusion in user Makefiles" is a good catch, and I was going to suggest using a longer name, like OCAML_INSTALL_CMD, in Makefile.config, and then rebinding that to our convenient name in Makefile.common. But then, looking at Makefile.config, I see that we keep adding non-namespaced variables, like NATIVE_COMPILER or FUNCTION_SECTIONS added recently. Given that the cat is already out of the bag, I don't see a reason to special-case INSTALL, especially given the convenience benefits of having only one configure-generated file.

@dra27
Copy link
Copy Markdown
Member

dra27 commented Apr 17, 2020

INSTALL is extremely common where the other new ones are not, though. It's also the case that the command used to install OCaml is not of interest in the installed configuration Makefile, whereas both NATIVE_COMPILER and FUNCTION_SECTIONS, for example, are.

@trefis
Copy link
Copy Markdown
Contributor

trefis commented Apr 17, 2020

@gasche: this looks like something that could interfere with the dune build. Could you try to dune build @libs and see if everything still works?
If not, and you don't want to fix it, just ping me here and I'll have a look.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Apr 17, 2020

@dra27 INSTALL_CMD?

@trefis no I haven't looked, sorry. There is no ill will on my part but I never know how to even run the dune build, and my attempts fail with an error 90% of the time, so I'm not the right person to check this. (My merlin workflow is to copy a .merlin file with the right S and B things to work with the regular Make, and frankly I think about trying to upstream this again each time I have to copy it to a different repository checkout.)

@dra27
Copy link
Copy Markdown
Member

dra27 commented Apr 17, 2020

Renaming it would certainly work, but it does feel better to move it to another file completely - the information has no purpose being installed. I don't see what the "convenience benefits" of having one configure-generated file are?

@trefis
Copy link
Copy Markdown
Contributor

trefis commented Apr 17, 2020

I just checked the dune build, it seems to be working fine.

If you can lend me some help, I'm willing, this week-end, to try adding a "merlin" makefile rule (that would call dune), add some documentation to HACKING.adoc, and add a travis check that the rule works (that's the part for which I need help).
Interested?

@shindere
Copy link
Copy Markdown
Contributor

shindere commented Apr 17, 2020 via email

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Apr 17, 2020

@trefis happy to help with that.

@dra27 @shindere I cannot tell if you are both suffering from Stockholm syndrome or if I'm the only one who strongly dislikes having to deal with .in files, but if your opinion does not change and someone else does not come up with a different opinion I will just have to close this PR.

dra27 added a commit to dra27/ocaml that referenced this pull request Apr 17, 2020
dra27 added a commit to dra27/ocaml that referenced this pull request Apr 20, 2020
@dra27
Copy link
Copy Markdown
Member

dra27 commented Apr 20, 2020

The thing which confuses me slightly is that you seem to be insisting on conflating two things - there's the developer-benefitting "don't put non-configure related things in a file generated by configure" (i.e. be able to put recipes, common definitions and so forth in Makefile.common without losing them) and an unrelated allergy to having 4 files generated by configure instead of 3. As proposed, this PR unnecessarily has a user-visible change, where it could be entirely internal. My suggestion also doesn't interfere with the desire not to have to deal with .in files - you now only need to edit Makefile.config.in or Makefile.build_config.in if you're actually working on configure.ac (and I greatly sympathise with no one's wanting to do that...)

Anyway, the merging of #8639 and a variable change in #9332 means that #9332 is now blocked on this PR. #9332 contains a version of this PR which introduces Makefile.build_config.in to house INSTALL, INSTALL_PROG and INSTALL_DATA and also adds variables new in that PR which don't want to go in Makefile.config.in but are discovered by configure.ac.

Can we move to a decision on what happens with this PR so that the other can be rebased (if necessary) or just merged.

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Apr 20, 2020

I think than what you are saying is that what I want is to have only the strictly necessary stuff in .in templates, so I have to deal with them the least often; it's not about the number of such template files.

This is a good remark and I mostly agree. Note that the difference in handling template makefiles vs. normal files (in gitignore etc.) means that adding new template files also has a cost (a lot of ceremony), so personally my impression is that restricting oneself to just one (minimal) template file would be the best scenario; but if I understand correctly, this is incompatible with the current installation technique we use for Makefile.config, which is just a copy whose output is expected to be greppable (so in particular that file could not include Makefile.really_config and remain useful for users).

I think that the best route of action is to close the current and go with your version in #9332; if I understand your point correctly, it will make me happy (assuming correctly that I may hack on Makefile.common in the future, but much less on Makefile.build_config), and it also makes you happy for other reasons. Besides, I'm happy to leave the configure stuff to the configure experts! Closing.

@gasche gasche closed this Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants