From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id E762082098 for ; Mon, 5 Aug 2013 13:42:19 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.17.12; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=mailfrom; client-ip=212.227.17.12; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.17.12; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmICAOSO/1HU4xEMm2dsb2JhbABAGoM7uhCGUxYOAQEBAQEGCxQUKIJlezQFKE+HYgEWCDKUKJZWH4kWjUCCdoMDdAOBTZYSgSuEaI5W X-IPAS-Result: AmICAOSO/1HU4xEMm2dsb2JhbABAGoM7uhCGUxYOAQEBAQEGCxQUKIJlezQFKE+HYgEWCDKUKJZWH4kWjUCCdoMDdAOBTZYSgSuEaI5W X-IronPort-AV: E=Sophos;i="4.89,817,1367964000"; d="scan'208";a="28517421" Received: from mout.web.de ([212.227.17.12]) by mail2-smtp-roc.national.inria.fr with ESMTP; 05 Aug 2013 13:42:19 +0200 Received: from frosties.localnet ([95.208.119.3]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0LgYi5-1UIRdW042f-00nyXK for ; Mon, 05 Aug 2013 13:42:19 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.80) (envelope-from ) id 1V6JB4-0005y1-Fl for caml-list@inria.fr; Mon, 05 Aug 2013 13:42:18 +0200 Date: Mon, 5 Aug 2013 13:42:18 +0200 From: Goswin von Brederlow To: caml-list@inria.fr Message-ID: <20130805114218.GA22848@frosties> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Provags-ID: V03:K0:wg/2DmNfH1iSCcRgg7bSVFMVsmVaaNk92zdRdICIvKjBS1bCP9C BYUK5G030Uk01DVTtvXzX+xDuWmwTqIji4Kt2SbRSJnKTYZ4njCG/Sp0LcXsXSQ9Ee7vrgP 7AoMlWcQkIYE+58kHxB+VPj581aYX3Hvpx1BX0jQO5O6mx88Td4OoS8OwOLLtSxKTzC4TFw WhoNllUyWo+rj362E4oOQ== Subject: [Caml-list] Avoiding double building of cmi files, building inferred mli files 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