caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Avoiding double building of cmi files, building inferred mli files
@ 2013-08-05 11:42 Goswin von Brederlow
  0 siblings, 0 replies; only message in thread
From: Goswin von Brederlow @ 2013-08-05 11:42 UTC (permalink / raw)
  To: caml-list

Hi,

in http://caml.inria.fr/mantis/view.php?id=4991 the problem of both
cmo and cmx rules also building cmi files is discussed.

My solution to that (tries to) solves 3 problems:

1. I like to see what types ocaml actualy inferrs for my classes. The
   inferred types are also a good starting point for writing mli files.

2. When a .ml file without .mli file is changed the .cmi is implicitly
   rebuild. This causes everything depending on the .cmi file to be rebuild
   too, even if the .cmi hasn't changed.

3. When doing parallel builds the .cmi file is build implicitly when building
   .cmo and .cmx. This can happen in parallel causing errors. And if it
   doesn't happen in parallel the second build screws up the timestamp
   causing things to be rebuild on the next make run for no reason.

As first attempt I build .inferred files from .ml files and then
compile them to .cmi files. I also prevent .cmo and .cmx rules from
overwriting the .cmi. This solves the first and third problem.

To solve the second I added a .inferred.new step and .inferred is only
overwritten if it differs from .inferred.new.

https://github.com/mrvn/ocam-problems/tree/infered

Maybe others find this interesting too.

Remaining Problem
=================

At the bottom of the Makefile you see 2 manual dependencies:
```
b.inferred.new: a.cmi
c.inferred.new: b.cmi
```

ocamldep can't generate them, it won't even output the dependencies
for the cmi files:
```
b.cmi: a.cmi
c.cmi: b.cmi
```
Those are only added if there are mli files.

I'm looking for a way to generate the dependencies automatically now.
Ideas are welcome.

MfG
	Goswin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-05 11:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 11:42 [Caml-list] Avoiding double building of cmi files, building inferred mli files Goswin von Brederlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).