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

MPR#5107: ocamlbuild misses local C #includes #220

Open
damiendoligez opened this issue Mar 3, 2017 · 1 comment
Open

MPR#5107: ocamlbuild misses local C #includes #220

damiendoligez opened this issue Mar 3, 2017 · 1 comment

Comments

@damiendoligez
Copy link
Member

PR transferred from https://caml.inria.fr/mantis/view.php?id=5107
[original reporter: Camarade_Tux]

When a .c or .h file uses #include "foo.h", ocamlbuild has to copy that file in the _build directory but currently it doesn't, making the build fail.

The attached patch (against today's svn) uses cpp to get these dependencies for .c and .h files: .c files are "allowed" to include .c and .h files while .h files can only include .h files.
The reason for this limitation is that the whole list would be: c, cpp, cxx, cp, C, h, hpp, hxx, hxp, H, CPP, HPP, c++, h++, tcc, hh, cc and I took a conservative approach.

The patch also changes Lexers.ocamldep_output to make it work with cpp's output (or ocamldep without -modules).

@whitequark
Copy link
Member

Note: there is a bug in the patch:

I just found out that if there are two files "foo.c" and "foo.h", the .c file will never be picked up (internally, the extension is dropped).

There might be a very simple fix: try to copy both, if "foo.*" is being used, chances are both "foo.h" and "foo.c" are used. Unfortunately, but unfortunately I don't have the time to do it right now since I'm on the leave (for a place without a real internet access).

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

No branches or pull requests

2 participants