Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow easy retrieval of Makefile.config's values #7116

Open
vicuna opened this Issue Jan 5, 2016 · 3 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Jan 5, 2016

Original bug ID: 7116
Reporter: adrien
Status: feedback (set by @shindere on 2017-02-22T15:11:36Z)
Resolution: open
Priority: normal
Severity: feature
Category: configure and build/install
Related to: #4957

Bug description

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.

print-%:
@echo $=$($)

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.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jan 5, 2016

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).

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Feb 22, 2017

Comment author: @shindere

Isn't ocamlc -config enough? Can you give an example of a place where this would improve the situation?

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Oct 14, 2017

Comment author: @gasche

#1430 proposes a -config-var option for 4.07:

#1430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.