caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: [Caml-list] Avoiding double building of cmi files, building inferred mli files
Date: Mon, 5 Aug 2013 13:42:18 +0200	[thread overview]
Message-ID: <20130805114218.GA22848@frosties> (raw)

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

                 reply	other threads:[~2013-08-05 11:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130805114218.GA22848@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).