From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B9CC5800D1 for ; Wed, 1 Feb 2017 18:11:14 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-qt0-f169.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.216.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.216.169 as permitted sender) identity=mailfrom; client-ip=209.85.216.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.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@mail-qt0-f169.google.com) identity=helo; client-ip=209.85.216.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-qt0-f169.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3As5y2mxSCPMBzUfEoxhWUWU4Z9tpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6zYByN2/xhgRfzUJnB7Loc0qyN4vymBzNLsMrJmUtBWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6?= =?us-ascii?q?OPn+FJLMgMSrzeCy/IDYbxlViDanb75/KBq7oR/Qu8QUjodvLqk8wQbVr3VVfO?= =?us-ascii?q?hb2XlmLk+JkRbm4cew8p9j8yBOtP8k6sVNT6b0cbkmQLJBFDgpPHw768PttRnY?= =?us-ascii?q?UAuA/WAcXXkMkhpJGAfK8hf3VYrsvyTgt+p93C6aPdDqTb0xRD+v4btnRAPuhS?= =?us-ascii?q?waLDMy7n3ZhdJsg6JauBKhpgJww4jIYIGOKfFyerrRcc4GSWZdW8pcUTFKDIGh?= =?us-ascii?q?YIsVF+cOP+hYoYnzqVUNsBWwGxWjCuz0xz9Un3/7x7E23/g9HQzE2gErAtIAsG?= =?us-ascii?q?7TrNXwLKocUPq6w7LSzTXCcfxW3Sr25pXUfRAhv/6MR6x/cdDMwkQoGAPKlE6f?= =?us-ascii?q?qZbkPzyL0uQBqXOb4PZgVe2xkW4otRtxryOgxscpkIbJh4YVxkrY+iV+xYY4PN?= =?us-ascii?q?u1Q1N1b96jFZtfrSCaN41uT8MjRWFooic6xacctZ61ZigG0Jsnxx/Da/yHboiH?= =?us-ascii?q?+QjvW/qWITd9nH5qZKq/hw618US6z+38Us+520tJoCpditTAqGwB2hjJ5sWESv?= =?us-ascii?q?Zx5Fmt1SuO2gzJ9+1JIEQ5mKzGIJA72LEwjIAcsUHbEy/2hkr2iKiWe10h+uey?= =?us-ascii?q?6uTnZqzqpoaAN4Nokw3+PLkil827DOgiPQgOWG+b+eu41LL950H2XLJKjvgunq?= =?us-ascii?q?nYtpDVO9gbq7anDwNJ1osv8RWyAje83NgGgHUKLUhJdA+GgoXtI13OJer3Dfa7?= =?us-ascii?q?g1SiijdrwPXGM6XuAprXNXfDirbhcqh560JG0wo80dBf6IxOCr4fOvL+QUDxtN?= =?us-ascii?q?nCAR84Nwy42froCNJ41o8GQ2KAHreZML/OsV+P/u8vLfGMZIgJuDbhKvgq+eTu?= =?us-ascii?q?gGQ4mF8ceKmmxoEXZ2qiEvRnJUWZe3vsjc0bHWcEpAo0VPbqh0GaUT5Pe3ayWL?= =?us-ascii?q?ox6S0hB4KjCYfPX4StgL2a3CenBZBWfWBHClWUEXjybYmEWvEMaDiTIsB7iDAE?= =?us-ascii?q?W6KhGMcd0kSArgb8RL1mNd3s/TEEtJ/5nIx7/eTVnhYz7npsCNiB0myXZ2ByhG?= =?us-ascii?q?IBATEsivNRu0t4n3iK27J5jvgQLtdT6ulESE9uOpfW1e13D5bpUQLMZNqTYFmj?= =?us-ascii?q?S9SiRzo2S4RikJc1f09hFoD63Vj41C2wDupQzuTTCQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0A8BQAPFpJYhqnYVdFdFgUBAQEDAQEBC?= =?us-ascii?q?QEBARYBAQEDAQEBCQEBAYNKP4EJB4NQnBCIfI5GLIUsSgKCNgdDFAEBAQEBAQE?= =?us-ascii?q?BAQEBEgEBAQgLCwodL4IzGwGCGwEFIwQZARsdAQMMBgULDQICJgICIgERAQUBH?= =?us-ascii?q?AYTiVkBAxUOoDQ/jAKBaxgFARyDCQWDZAoZJw1VgxABAQEBAQEEAQEBAQEBARk?= =?us-ascii?q?CBhJ5hUCEb4RNgwaCXwWbXIF9hGqLHIF5U4gPhiKROxQegRQ2gTwTHWeEHSCBb?= =?us-ascii?q?T81iB0BAQE?= X-IPAS-Result: =?us-ascii?q?A0A8BQAPFpJYhqnYVdFdFgUBAQEDAQEBCQEBARYBAQEDAQE?= =?us-ascii?q?BCQEBAYNKP4EJB4NQnBCIfI5GLIUsSgKCNgdDFAEBAQEBAQEBAQEBEgEBAQgLC?= =?us-ascii?q?wodL4IzGwGCGwEFIwQZARsdAQMMBgULDQICJgICIgERAQUBHAYTiVkBAxUOoDQ?= =?us-ascii?q?/jAKBaxgFARyDCQWDZAoZJw1VgxABAQEBAQEEAQEBAQEBARkCBhJ5hUCEb4RNg?= =?us-ascii?q?waCXwWbXIF9hGqLHIF5U4gPhiKROxQegRQ2gTwTHWeEHSCBbT81iB0BAQE?= X-IronPort-AV: E=Sophos;i="5.33,320,1477954800"; d="scan'208";a="211692180" Received: from mail-qt0-f169.google.com ([209.85.216.169]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 01 Feb 2017 18:11:13 +0100 Received: by mail-qt0-f169.google.com with SMTP id v23so274237577qtb.0; Wed, 01 Feb 2017 09:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=SoVm0v0zxUFyfYMEY6NsSLg5ghXpd09VixqPHhza6AU=; b=u3KU6+/iQ+3AfmoYYrihXy0Hyt1dMOguuDSJfAcHvqIhnS+I3S12M/LsOGAWcZ1rjj QRbZK3t6jr0o1sw6GqLPcTLcBx3q2JDlsglWWE3Au5TukYPYCV7DYBx/jvXRh4hJagJY nmFcB1JSqdA343joztXhEEPwjhnR6yjAG22XfLzymalR3gOkYVTuRyUGzoDXZyN6vh/w mr90S5BzoPnN09eurlHXYG0kWtKz7CMbfuxcFdpaqppUJVNkGvrWNhYkXqZKjXLzDB+n uBiHZEIxkRlXP35yfhYui+OeN11E7wTtCEpHkkAAfKz2QPXl1R6AGevMqrUnPjK3e6R1 tD+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=SoVm0v0zxUFyfYMEY6NsSLg5ghXpd09VixqPHhza6AU=; b=jUwl0EYJ2AsCeelBSKLiuGZglywuBhsPJrQ0V02Lyu45t6PhtH07vMnnyYICdT9G7h E86l9Di52qKGgzDjTkgjkSlUoaw7WKIqE4gFqDkmg77aW1HmfAKsCDXDKS1dCobGCEoe lFAQlfrW8d7v6gQ5JBkn1zSfOXBfi8apUyXUwKfUWVQ02tz8LeJSVYjw4+TmfKFsNjEu EwRzMGS+qCChONlcR8bLkNlBUh3woRi52Xpw4kei/Fo3Pew9gzAiyFEL7AoayV1Cz1qO 2TncQiCmtj30kgHyltfT7sZCpRzAjaYF02nZw4oC6Vfxu3lSAzOE4K6oUHuIPr4FZ8Hq fyQg== X-Gm-Message-State: AIkVDXLwgijylDQIBJAeGe/5WB4Ty++lowJGL1jGlkYWkf9puG3Uh8yqElWLFHYjL45fzVuKCcUykayc9GUzQg== X-Received: by 10.200.46.36 with SMTP id r33mr4142335qta.92.1485969071807; Wed, 01 Feb 2017 09:11:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.177.154 with HTTP; Wed, 1 Feb 2017 09:10:31 -0800 (PST) In-Reply-To: References: <58910692.1060706@inria.fr> From: Gabriel Scherer Date: Wed, 1 Feb 2017 18:10:31 +0100 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Pottier?= Cc: caml users , github@mjambon.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] cppo, ocamlbuild, and dependencies Yes, of course, your approach would also work (`Ocamlbuild_plugin.read_file` is you friend, followed by the parsing technique of your choice). The only issue is that you may over-approximate dependencies depending on how closely you approximate cppo's grammar (and I don't know, maybe there is a way to have computed inclusion instead of just file path literals?), so this logic would be easier to implement correctly in cppo itself. You may find inspiration in the part of the manual that describes how to write rules with dynamic dependencies (the explained example is the code of the (.itarget -> .otarget) rule): https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc#Subsec= _Rules__Dynamic_dependencies On Wed, Feb 1, 2017 at 2:40 PM, Fran=C3=A7ois Pottier wrote: > > On 01/02/2017 11:19, Gabriel Scherer wrote: >> >> In the meantime, I implemented an amusing hack at the ocamlbuild level > > > Thanks Gabriel for your quick reply. > > This seems amusing indeed, but does not quite work for me. Running > ocamlbuild > once fails, complaining that A.ml does not exist (whereas A.cppo.ml exist= s). > If I immediately run ocamlbuild again, the build succeeds. > > I think I would prefer to use a slightly less amusing approach and just f= ind > out, ahead of time, what the dependencies are. In the rule that transforms > %.cppo.ml to %.ml, could I just read the source file, looking #include > patterns, and ask that the included files be built first? > > > -- > Fran=C3=A7ois Pottier > francois.pottier@inria.fr > http://gallium.inria.fr/~fpottier/