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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id A301C7F72A for ; Tue, 9 Aug 2016 21:02:30 +0200 (CEST) IronPort-PHdr: 9a23:vg68Sx0c/4qxp+oOsmDT+DRfVm0co7zxezQtwd8ZsekWK/ad9pjvdHbS+e9qxAeQG96KsrQc0qGN7OigATVGusfZ9ihaMdRlbFwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8Kum9IIPOlcP/j7n0oMyKJV0Rz2HiKfMqdVPt/F2X7pFXyaJZaY8JgiPTpXVJf+kEjUhJHnm02yjG28Gr4ZR4+D5Rsf9yv+RJUKH9YrhqBecAVGduGykP6cbqrRjOSxeUrjtZCz1O00kAPw+QphT9WYz2riDSue902S3cNsrzB/hgXDOl9KB3QzfnjS4GM3gy92SB2eJqi6cOjBu/phA36orQe4aNLLIqcrnUONUXWnFpW8tNXjddC4i/KYAICrxSbq5js4Dhqg5W/lOFDg62Cbaqk2cQiw== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=dra-news@metastack.com; spf=Pass smtp.mailfrom=dra-news@metastack.com; spf=None smtp.helo=postmaster@outmail149055.authsmtp.co.uk Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.149.55; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of dra-news@metastack.com designates 62.13.149.55 as permitted sender) identity=mailfrom; client-ip=62.13.149.55; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@outmail149055.authsmtp.co.uk) identity=helo; client-ip=62.13.149.55; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail149055.authsmtp.co.uk"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CPAQBIKKpXfTeVDT5dgxiBA3wHpBUBAQaIWI4lHIYBAoFMOxEBAQEBAQEBAREBAQsUCT0LgjIEARMBghMBAQU6OgUQAgEIGB4QIRElAgQOBQgSh30DGAMBvQQNhCwBAQEBBgEBAQEBAQEBH4VihRWCQ4F/gyqCLwWZBTSMT4I7Co85iC0hh140hBpuhi1/AQEB X-IPAS-Result: A0CPAQBIKKpXfTeVDT5dgxiBA3wHpBUBAQaIWI4lHIYBAoFMOxEBAQEBAQEBAREBAQsUCT0LgjIEARMBghMBAQU6OgUQAgEIGB4QIRElAgQOBQgSh30DGAMBvQQNhCwBAQEBBgEBAQEBAQEBH4VihRWCQ4F/gyqCLwWZBTSMT4I7Co85iC0hh140hBpuhi1/AQEB X-IronPort-AV: E=Sophos;i="5.28,496,1464645600"; d="scan'208";a="187302777" Received: from outmail149055.authsmtp.co.uk ([62.13.149.55]) by mail3-smtp-sop.national.inria.fr with ESMTP; 09 Aug 2016 21:02:16 +0200 Received: from mail-c232.authsmtp.com (mail-c232.authsmtp.com [62.13.128.232]) by punt21.authsmtp.com (8.14.2/8.14.2/) with ESMTP id u79J2FCm006380; Tue, 9 Aug 2016 20:02:15 +0100 (BST) Received: from romulus.metastack.com (114.212-105-213.static.virginmediabusiness.co.uk [213.105.212.114]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id u79J2DPi073840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Aug 2016 20:02:13 +0100 (BST) Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id u79J2CEJ009101; Tue, 9 Aug 2016 20:02:12 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0301.000; Tue, 9 Aug 2016 20:02:12 +0100 From: David Allsopp To: "moosotc@gmail.com" CC: Gabriel Scherer , caml users Thread-Topic: [Caml-list] Interface(.mli) location Thread-Index: AQHR8m08WCvy6CNG7kmmtpBMUxmENKBA+2eA Date: Tue, 9 Aug 2016 19:02:11 +0000 Message-ID: References: <8737mfp7j3.fsf@gmail.com> <87y447npv3.fsf@gmail.com> <87r39znl6m.fsf@gmail.com> <87mvknnia0.fsf@gmail.com> <87r39xbxec.fsf@gmail.com> In-Reply-To: <87r39xbxec.fsf@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.0.29] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: c861f58a-5e63-11e6-829e-00151795d556 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNl8UURhQ KkJXbgESJgVNAnhE VHkJW1VSQF9xU2N3 YQtSIwdcYVRPXwB0 UklLXFNTEBpqBAMA SFsZW2NwA2UfeHlz bUJiEHFfVEV7OxV1 RE8CEGVXeGI1bmMC UUENcR5ccgofYx9F a1V+U3oINWACYDQC Ml17DBs4ODEaLCVO XjRFDFQOTFwFFzUx B1YHGTRuVUkCTCwv LhsgQl4B X-Authentic-SMTP: 61633634383431.1037:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: RE: [Caml-list] Interface(.mli) location moosotc@gmail.com wrote: > David Allsopp writes: >=20 > > moosotc@gmail.com wrote: > >> David Allsopp writes: > >> > >> > moosotc@gmail.com wrote: > >> >> David Allsopp writes: > >> >> > moosotc@gmail.com wrote: > >> >> >> Gabriel Scherer writes: > >> >> >> > >> >> >> > It is correct that ocamldep assumes that the .ml and .mli of > >> >> >> > a given module are at the same place, but this is not the > >> >> >> > case for the rest of the compilation chain, which is either > >> >> >> > concerned with single source files (a .ml file or a .mli > >> >> >> > file) or with "compilation units" (a .cmo and .cmi files > >> >> >> > passed together, independently of where their source files > >> >> >> > were). In particular, all type-checking tools do look in -I > >> >> >> > directories to find .cmi files for the dependencies of the > >> >> >> > module being compiled (and at this stage > >> >> they do not care for .mli files). > >> >> >> > >> >> >> But the script seems to (somewhat) contradict this, i.e. after > >> >> >> `ocamlc -I d -c a.ml' ocamlc ignores the presence of .mli > >> >> >> inside subdirectory d/, producing both .cmi/.cmo when when > compiling a.ml. > >> >> > > >> >> > The -I option specifies extra directories for compiled files > >> >> > only, so it's correct that the compiler ignores d/a.mli. > >> >> > >> >> After sending the first post I've realized that: ocamlc -c d/a.mli > >> >> was forgotten, but even after adding that to the script things do > >> >> not change, i.e. following compilation of a.ml with -I d where d > >> >> contains a.cmi still produces both a.cmo and a.cmi in the top-level > directory. > >> > > >> > Indeed - but that's the correct documented behaviour, even if not > >> > necessarily the ideal. There are various things you can do: > >> > > >> > a) Delete ./a.cmi as part of your build procedure. This isn't > >> > ideal, though, because you lose the type-checking against d/a.cmi > >> > b) Have an empty ./a.mli but never compile it - the compiler will > >> > then unify ./a.cmo against d/a.cmi. This isn't ideal because having > >> > a source file which you don't expect to compile will confuse > >> > dependency generators and automatic build rules. > >> > c) Implement a new option in the compiler driver which suppresses > >> > the automatic generation of .cmi files (e.g. ocamlc -c -I d -no-cmi > >> > a.ml) > >> > >> d) Make the compiler skip generation of .cmi if it sees one in the -I > >> directories? > > > > Of course, there is a dirty option e) if you have a.mli and a.cmi in > > directory d as before: > > > > ocamlc -intf-suffix .ml -I d -c a.ml > > > > will use the .cmi in d and not generate one in the current directory... > > >=20 > It's hairier than that when you think about -o (i.e. outputs go to the > specific build directory instead of the source tree) I'm probably being slow, but rather than just stating that it's hairier tha= n I think, could you give an example of how -o makes any difference to that? The somewhat dirty use of -intf-suffix means that the compiler will always = find a ".mli" file, and so will always *look* for a .cmi file (and so find = it in the -I directories in your case) and not write one *anywhere*, regard= less of -o David