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 830AB7FFE1 for ; Fri, 7 Oct 2016 03:23:57 +0200 (CEST) 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-it0-f46.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.214.46; 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.214.46 as permitted sender) identity=mailfrom; client-ip=209.85.214.46; 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-it0-f46.google.com) identity=helo; client-ip=209.85.214.46; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-it0-f46.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AFdFAwxQ/ctBkARK0hW4dAa2rF9psv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa64bByN2/xhgRfzUJnB7Loc0qyN4vqmAjdLvM/JmUtBWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4?= =?us-ascii?q?Ov7yUtaLyZ/mjabpoNaOOk1hv3mUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD88Qa6tVYXK7mU6M9RL1eRHR6YiFmrPHs4DLD?= =?us-ascii?q?VwqU+nwEUlI2DBVFGUCR5xHgX4zttTP68Op61SaXJ+XqUPU+VC6m7qEtRBK+2w?= =?us-ascii?q?kdMDts32jdkM19iOpgqxKsvRFli9rbaYuPNfd6OLjWfd4ASHBpUcNYVigHCYS5?= =?us-ascii?q?OdhcR9EdNPpV+tGu72AFqgGzUFX9CQ=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C/AQDa9/ZXhi7WVdFcGwEBAQMBAQEJA?= =?us-ascii?q?QEBFwEBBAEBCgEBgxIBAQEBATw5fAeNLJcAgiqGGYtpggsohS5KAoFnBzgUAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBCAsLCRkvgjIEAwMVghEBAQQSER0BGxILAQMMBgULDQICC?= =?us-ascii?q?R0CAiIBEQEFAQoSBhMSEIgRAQMXDqQ0gTI+MotCgWuCXwWDcAoZJwMKU4MLAQE?= =?us-ascii?q?BAQEBAQMBAQEBAQEBGAMGEHeFNYRVgmOBZIMEglsFhm8Mhz+LRYFlhEODBIZPg?= =?us-ascii?q?jyNOIx3gj0THoERHnWCaA8RC4FvIjSGNYEtAQEB?= X-IPAS-Result: =?us-ascii?q?A0C/AQDa9/ZXhi7WVdFcGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxIBAQEBATw5fAeNLJcAgiqGGYtpggsohS5KAoFnBzgUAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBCAsLCRkvgjIEAwMVghEBAQQSER0BGxILAQMMBgULDQICCR0CAiIBEQEFAQo?= =?us-ascii?q?SBhMSEIgRAQMXDqQ0gTI+MotCgWuCXwWDcAoZJwMKU4MLAQEBAQEBAQMBAQEBA?= =?us-ascii?q?QEBGAMGEHeFNYRVgmOBZIMEglsFhm8Mhz+LRYFlhEODBIZPgjyNOIx3gj0THoE?= =?us-ascii?q?RHnWCaA8RC4FvIjSGNYEtAQEB?= X-IronPort-AV: E=Sophos;i="5.31,454,1473112800"; d="scan'208";a="195914396" Received: from mail-it0-f46.google.com ([209.85.214.46]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 07 Oct 2016 03:23:56 +0200 Received: by mail-it0-f46.google.com with SMTP id o19so3164212ito.1 for ; Thu, 06 Oct 2016 18:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tOzYAth7gXx5f0c+TX71W6iyuqMQ7iCF93z5cToLs5g=; b=aEWicnFvy5OZxdcWaH7rpFAmJOyhlxo3TIbA8e8ZzRPmYwJ468X4r8bof2NSOUydL2 Yo1bY+MoEMPkOj4QriItmPb/0dV8bcqsZ4x+swx5oxn7WAlOiASoQ4BG9wYGfIMpb7wC Ie6COPLPdKKt8LDM91QcA4S+qyM4IClyamyeaWhlw6dg2ZkBYCDiyMVUspG7TrgykdEB jarb3QqPZ1DEn3VpJyb3Gmq4emzkPGk/OudYPxIIRVEwhnX4fecelpwi1bN7hxvOqq2p WOQ+wP9bN6HKueCy32BAB/Ecv/6Mpv3HjjrR6s5l8wtxV+wRiQpg4e8YuSw7JivmPIP+ Dvtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tOzYAth7gXx5f0c+TX71W6iyuqMQ7iCF93z5cToLs5g=; b=MbVaEvGhfxVXGmfwuDDnwhit9P/KrCWxS9vw3NvwMk/Kyd/hju7Up8/7gBWvH9Zzz2 ejQJRMwldHwskul6m3nHeRZYltc0C8Cyph/Em+NLDDKgX+wxRKgujn9L2uveXmXeO9Zg bbROmE4l4ihEMu6V7lnFBmIiawyeYRpELO6d5a5xWpL1c6NGlB9T2oemuS23n2GwUoYq CkpMjg+q9yLBKTbXoT/+owt/OHRktitrc3/1tnISg7csU72Js7N1H0d7fw5v7oFNQHRE jQYIqgLe/gotNHBBWKuRTBzwRKgsahomy0b5Hh8KxWrmZqzoWiFCY9cOVWECjaqflh25 4eJA== X-Gm-Message-State: AA6/9RneK+uJW9Vl+4iEBW4/SDtke0ZizO7LlQmvFzN8gXxnOOduYdFwgpqgUi/7k2qtiiXnxkVw6GSKJIAj3A== X-Received: by 10.36.131.10 with SMTP id d10mr17200503ite.3.1475803434813; Thu, 06 Oct 2016 18:23:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.129.219 with HTTP; Thu, 6 Oct 2016 18:23:14 -0700 (PDT) In-Reply-To: <838cb092-c371-2c79-75f6-7193e6ed6396@tu-berlin.de> References: <838cb092-c371-2c79-75f6-7193e6ed6396@tu-berlin.de> From: Gabriel Scherer Date: Thu, 6 Oct 2016 21:23:14 -0400 Message-ID: To: =?UTF-8?Q?Christoph_H=C3=B6ger?= Cc: caml users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] ocamlbuild pattern language OR Hi Christoph, ocamlbuild does not currently support patterns in dependencies, except for names of variables defined in the productions. The productions can contain patterns, including disjunctions, using the syntax %(name:pattern), for example "%.%(ext:foo|bar)". Note that the ~deps field only contains the static dependencies, which are declaratively provided in the rule declaration. You have much more flexibility in the dynamic dependencies, which are the target that the rule action may request (they need not be part of the static dependencies). In particular, in a rule you can request at any time the build of a (conjunctive) list of (disjunctive) list of targets (for each element of the outer list, at least one element of the inner list must be buildable), so just calling the build on [[env "%.foo"; env "%.bar"]] will have the semantics you expect. See the documentation of dynamic dependencies in the manual: https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc#Subsec= _Rules__Dynamic_dependencies That said, if you were willing to experiment with a patch to provide that functionality (disjunctions in static dependencies), I have the impression that it would be not be too difficult to implement, and I don't see an immediate problem that this would cause -- with the expected semantics that the rule would fire if all its dependency patterns have at least one buildable match. Currently the ocamlbuild solver recursively builds all dependencies of a rule, https://github.com/ocaml/ocamlbuild/blob/a4966a4/src/solver.ml#L74 if we allowed patterns in rules, we could have a pattern (a regular expression) for each dependency instead of just a pathname. We would have to write some code in glob.ml to enumerate all strings matched by a pattern; mapping this function over the list of dependencies would return a (conjunctive) list of (disjunctive) alternatives to build, which can be passed to the solver. On Thu, Oct 6, 2016 at 11:42 AM, Christoph H=C3=B6ger wrote: > Dear all, > > I am in the process of writing a set of ocamlbuild rules. > In order to simplify some rules, I'd wanted to merge them (as the > invoked tool dispatches over the file extension anyway). However, I fail > to create an OR-pattern in the rule-declaration: > > rule "description" > ~prods:["%.out"] > ~deps:["%.{foo,bar}"] (* tried _tags syntax, does not work *) > ~doc:"Generate *.out from *.foo or *.bar" > make_out_command ; > > Does anyone know how to solve this? > > thanks, > > Christoph > -- > Christoph H=C3=B6ger > > Technische Universit=C3=A4t Berlin > Fakult=C3=A4t IV - Elektrotechnik und Informatik > =C3=9Cbersetzerbau und Programmiersprachen > > Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin > > Tel.: +49 (30) 314-24890 > E-Mail: christoph.hoeger@tu-berlin.de > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs