Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow easy retrieval of Makefile.config's values #7116
Original bug ID: 7116
Currently the values in Makefile.config are difficult to extract. While looking at ocamlbuild's #38 PR on github I tried to get a cleaner way to get them and found out that someone has already done it elegantly and explained it well: http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html .
Basically, adding the following to a Makefile creates a pattern rule than can then be used to print the value of the variable which name is used in the pattern.
For instance, on my machine, "make -f config/Makefile print-MKEXE" will print "MKEXE=gcc". We can also skip the "MKEXE=" part if we want (I think it makes more sense for us actually).
This would greatly simplify changes in various places and avoid having to "include" the config makefile which means overwriting all the corresponding variables. It would help a lot to have it in 4.03.
Comment author: @gasche
One other approach to do this which I also considered is to make it easier to extract information from $(ocamlc -config) without parsing step. For example, $(ocamlc -config-key ext_obj) would be the string ".o".
I'm fine with adrien's proposal which seems easier to implement (-config exposes more information than Makefile.config, but in practice the information I needed is available in both).