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 C274A7F72A for ; Tue, 9 Aug 2016 20:38:38 +0200 (CEST) IronPort-PHdr: 9a23:t1ZS1hTIs3yxJb0TNJ2Dw8wZGtpsv+yvbD5Q0YIujvd0So/mwa64Yx2N2/xhgRfzUJnB7Loc0qyN4vmmATVLus/J8ChbNscdD1ld0YRetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScbshsi6n9q/54fUK10RwmHsOPUqdV7t9E2R7pBQ2to6bP5pi1PgmThhQ6xu32RmJFaezV7Xx/yb29pdyRlWoO8r7MVaUK/3LOwSRL1cCyk6YShuvJW4/TGKdwaE52MdX2MKiVIIRlGdtFCpFqv25wfzqOtxkACeOdbxVah8DTi45uJtRQDzoCIKKzci7GjciYp7i6cN8zy7oBkqxonTe4aJP9Jxe6rceZURQm8SDY5qSyVdD9bkPMM0BO0bMLMd9tGlqg== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=moosotc@gmail.com; spf=Pass smtp.mailfrom=moosotc@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f41.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of moosotc@gmail.com) identity=pra; client-ip=74.125.82.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="moosotc@gmail.com"; x-sender="moosotc@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of moosotc@gmail.com designates 74.125.82.41 as permitted sender) identity=mailfrom; client-ip=74.125.82.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="moosotc@gmail.com"; x-sender="moosotc@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f41.google.com) identity=helo; client-ip=74.125.82.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="moosotc@gmail.com"; x-sender="postmaster@mail-wm0-f41.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BuAQBBIapXhilSfUpdhBt8uSSBfRyGAQKBTDkTAQEBAQEBAQERAQEBCAsLCRkvgjIEARMBghMBAQQBAREuARsYBQEDAQsGBQsDCgkeBw8BBA0CEQEFAQsXExoIh3QBAw8IBKM/gTI+MY0lglsFhkgKGScNVINYAQEBAQEBAQMBAQEBAQEZAgYQhA+GWIJDh1gFjwmJfDSMT4I7iUeFfIgtIYYeMYEPIAOCVIFaa4csAQEB X-IPAS-Result: A0BuAQBBIapXhilSfUpdhBt8uSSBfRyGAQKBTDkTAQEBAQEBAQERAQEBCAsLCRkvgjIEARMBghMBAQQBAREuARsYBQEDAQsGBQsDCgkeBw8BBA0CEQEFAQsXExoIh3QBAw8IBKM/gTI+MY0lglsFhkgKGScNVINYAQEBAQEBAQMBAQEBAQEZAgYQhA+GWIJDh1gFjwmJfDSMT4I7iUeFfIgtIYYeMYEPIAOCVIFaa4csAQEB X-IronPort-AV: E=Sophos;i="5.28,495,1464645600"; d="scan'208";a="229468339" Received: from mail-wm0-f41.google.com ([74.125.82.41]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 09 Aug 2016 20:38:37 +0200 Received: by mail-wm0-f41.google.com with SMTP id q128so50189662wma.1 for ; Tue, 09 Aug 2016 11:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=/YfEl8rELbBiaM4lp6XuDz+rUZkLA8f3xOvUdEH+nJg=; b=cqTWeT0NsVvw+9GgTZpYRhKi4d7pa0OMMxx55D6/ekAJqriQOIm8s9fxNipL76aNKw 5vwXHNpKlg05HjulxJbeiGxCkWJ4qD3G1EAj8xRSgTLcyiwnKPoCMjoJrDegLU6IqMdd TBUBoThImbGcV5/4eVjPD8NSKDXn+Sbl86xZYMeh/7+MwWls5m9HR9xHkVKSKKjOgZSX eyhIn3SuIhwox+MTJq3DrdW9Azr4h18dxwN2p2SLauI8MfytD1WMZSs3WIJgXOV/Vibv S6y4+eapJoXLuOBrPZEECmYaySWqsUWPZ8EMtc6NHtK8jK2DU+qhdZdB4U2JXQMo1JxL 55qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=/YfEl8rELbBiaM4lp6XuDz+rUZkLA8f3xOvUdEH+nJg=; b=SYKow3qfyauMY7fPHZqSicK1+wfLoeDpnAEcjhat/mW8jaw2HCXn3jSC1SRCEebYvf 4e9/cL19McjoER/HGaYulqTrrQ6FR5+IFyqAn/kJ9MZtfx3ODdn1VQhggYsoty8T992I Ll3qUVpDeujzmxx3dNIIwHcH7yD6Y5bLfkxp1XNQPtnCOixb1Z9tDQr2YRHE39K2FL57 d32v9Xe7FVshizL/Wg7ahpjATmjqqPqSFjtiiXmPswu9vvMaeJ01uQ65o/wi5p01W+l+ IqTLYVauqRLH2ajQ5qkJatl88uhGCu0Vbk8Fg8X6QlOjptMb0V5Zwuj3ADPkHjB0XK7f AaLw== X-Gm-Message-State: AEkooutTF8Ce5NnPgofITtew8lEKnr9AjVOoxCFUZLy1rvkPS4V0Nk8G2g4znsN2+9TgDQ== X-Received: by 10.25.19.105 with SMTP id j102mr23806366lfi.44.1470767917212; Tue, 09 Aug 2016 11:38:37 -0700 (PDT) Received: from linmac2 ([188.123.252.212]) by smtp.gmail.com with ESMTPSA id f64sm6721553lfi.36.2016.08.09.11.38.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Aug 2016 11:38:36 -0700 (PDT) From: moosotc@gmail.com To: David Allsopp Cc: Gabriel Scherer , caml users References: <8737mfp7j3.fsf@gmail.com> <87y447npv3.fsf@gmail.com> <87r39znl6m.fsf@gmail.com> <87mvknnia0.fsf@gmail.com> Date: Tue, 09 Aug 2016 21:38:35 +0300 In-Reply-To: (David Allsopp's message of "Tue, 9 Aug 2016 18:33:13 +0000") Message-ID: <87r39xbxec.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Caml-list] Interface(.mli) location David Allsopp writes: > 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... > It's hairier than that when you think about -o (i.e. outputs go to the specific build directory instead of the source tree) -- mailto:moosotc@gmail.com